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

Re: RE: Repeat step in a Groovy test case

by Marc Guillemot :: Rate this Message:

Reply to Author | View in Thread

Hi,

you're right: repeat used with XPath doesn't store the counter as a
WebTest property as it is not really a counter but an element. The
"counter" is saved as XPath variable and therefore the syntax $rb here
should be interpreted by the XPath parser, not before by Groovy or by Ant.

Following should work:

repeat (xpath:"//input[@type='radio']", counterName:"rb") {
  verifyRadioButton xpath: '$rb', checked:"false"
}

Note the use of simple quotes instead of double quotes to use normal
strings and not GStrings.

Cheers,
Marc.
--
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com


Jean Hominal wrote:

> I don't know much about Groovy, but I think that it could be related
> to that which is explained there:
> http://docs.codehaus.org/display/GroovyJSR/Groovy+String+Handling
>
> I would replace
>>>         verifyCheckbox xpath:"$currentButton", checked:"false"
> with:
> verifyCheckbox xpath:'$currentButton', checked:"false"
>
> (Replacing double quotes with simple quotes to avoid escaping).
>
> Regards,



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

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