« Return to Thread: Repeat step in a Groovy test case

Repeat step in a Groovy test case

by Beat Koch-2 :: Rate this Message:

Reply to Author | View in Thread

I have a Groovy class that extends WebtestCase. I'm trying to write a  
method checkResetState() that checks if all input elements on the  
current page are reset (check boxes and radio buttons not checked;  
text fields empty). This is what I have done for radio buttons:

def checkResetState() {
   ant.repeat(xpath:"//input[@type='radio']", counterName:"rb") {
     ant.groovy {
       def button = step.webtestProperties.rb
       println button  // For debugging purposes

       ant.verifyRadioButton xpath:"$button", checked:false
     }
   }
}

The ant.repeat part is ok; if I have three radio buttons on the page,  
then the closure is called three times. However, rb is not set and  
therefore; button is always null. As an alternative, I've tried

   ant.repeat(xpath:"//input[@type='radio']/@id", counterName:"rb") {

to just get the id's of the buttons, or just

   ant.repeat(xpath:"//input[@type='radio']/@id") {

and trying to use the count property, but no luck either. I haven't  
figured out how to access the "current counter value". Can anyone help  
me out?

Regards
Beat

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest

 « Return to Thread: Repeat step in a Groovy test case