-
Notifications
You must be signed in to change notification settings - Fork 2
Data Parameters
Madcow provides an intuitive method for providing data parameters to Madcow tests.
- must be set before they are used
- can be overridden
- names must be unique with a test
- can be used to pass data to Madcow templates
To define a data parameter in a Madcow test we use the @ symbol followed by the name you give the data parameter.
The following example sets the variable 'myFirstName' to 'Harry'
@myFirstName=Harry
To use a data parameter in a Madcow test we again use the @ symbol followed by the name of the data parameter you require.
The following example would place the content of 'myFirstName' into the mapped firstNameField.
firstNameField.value = @myFirstName
Madcow provides the ability to store the value of a web page element during test execution and then to use the stored value within the Madcow test.
To define a runtime data parameter in a Madcow test we use the Madcow store operation on an web page element passing it the name of the data parameter to store.
In the following example read it as 'MyReferenceNumber is now a reference to the value of generatedReferenceNumber'.
generatedReferenceNumber.store = MyReferenceNumber
To use a runtime data parameter in a Madcow test we again use the @ symbol followed by the name of the stored data parameter.
This will set the mapped searchField to have the value referenced by MyReferenceNumber
searchField.value = @MyReferenceNumber
Madcow provides the following common global data parameters.
| @global.currentDate | dd/MM/yyyy |
| @global.currentTime12hr | hh:mm a |
| @global.currentTime24hr | hh:mm:ss |
| @global.currentDateTime12hr | dd/MM/yyyy hh:mm a |
| @global.currentDateTime24hr | dd/MM/yyyy hh:mm:ss |
To use a global data parameter in a Madcow test we again use the @ symbol followed by the name of the global data parameter.
date.value = @global.currentDate
time.value = @global.currentTime24hr
Data Parameters can be used within a list and with the Madcow table syntax.
@newZealand = NZD
@australian = AUD
@japanese = JPY
@selectDollarFieldValues = [@newZealand, @australian, @japanese]
dollarList.verifySelectFieldOptions = @selectDollarFieldValues
@selectedCountry = New Zealand
@selectedCountryCurrency = NZD
@selectRowCriteria = ['Country' : @selectedCountry]
@searchResultsCheckValues = ['Country' : '@selectedCountry', 'lastColumn' : '@selectedCountryCurrency']
searchResults.table.selectRow = @selectRowCriteria
searchResults.table.currentRow.checkValue = @searchResultsCheckValues
Data Parameters can be used within a Madcow Value. This allows partial substitution of the value with the data parameter.
This is done through @{...} syntax, with the contents within the curly braces defining the name of the data parameter.
@expectedResultCount = 20
verifyText = There are @{expectedResultCount} countries found
- Home
- Setting Up
- Configuration
- Writing Madcow Tests
- Running Madcow Tests
- Data Parameters
- Templates
- Macros
- Disabling A Test
- Spreadsheet Scenario Testing
Madcow Operations
- Madcow Operations
- Madcow Operations - Table
- Madcow Operations - XPath Extras
- List of Madcow Operations
Extending and Customising Madcow
Reference
For Developers