-
Notifications
You must be signed in to change notification settings - Fork 2
Macros
timfarr edited this page May 20, 2011
·
3 revisions
Macros give us the power to evaluate some groovy code, and have the result used in a Madcow step. This feature is simple, but extremely powerful.
Be aware, though, that it'll greatly reduce the maintainability of your scripts for people who don't know Groovy.
#Set a parameter called currentDate to have to the value of the current date
@currentDate=madcow.eval({ new Date().format('dd/MM/yyyy')})
#Set the accident time field to be the current time
accidentpage_accidentTime.setValue = madcow.eval({ new Date().format("H:m:ss") })
#Read the contents of the description file and input it into the description field
accidentpage_accidentDescription.setValue = madcow.eval({ new File('/tmp/descriptionFile.txt').getText() })
- 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