Skip to content

Data Parameters

DanDare2050 edited this page Jun 5, 2016 · 3 revisions

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

Data Parameters

Define a Data Parameter

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

Use a Defined Data Parameter

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

Runtime Data

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.

Define a Runtime Data Parameter

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

Use a Runtime Data Parameter

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

Global Data Parameters

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

Use a Global Data Parameter

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

Advanced Data Parameter Usage

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

Embedded Inline Data Parameters

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

Clone this wiki locally