I have recently started using the marvelous plugin Grails function Testing by Marc Palmer (http://www.grails.org/Grails+Functional+Testing).I would like to share few things with you about this plugin.
The purpose of testing get defeated if we keep on doing for the same values. The method below let you to do it for the different values each time.
def countryList = byName(’country’)
int randomIndex=new Random().nextInt(
byName() retrieve the element from the current page by its name attribute. Throws exception if multiple elements found with same name and null if no element found
In above example I am retrieving the select element of current page which has the name attribute ‘country’.
getOption() takes the integer as a parameter and return the option element of the current page at index 2
getValueAttribute() useful to get what the value need to be passed as params to the server. This method assures that value is passed rather than the name displyed in the list.
I hope this would help some of you.