Dierk,

I tried your latter suggestion (the first one didn't fit to my requirement):

>  storeXPath xpath:'//div[2]', property:'result'
>  groovy (replaceProperties:true) {
>    println '#{result}'
>  }

but this didn't work. (just printed "#{result")

According my brief investigation of the source code, the
"replaceProperties:true"
causes org.apache.tools.ant.Project#replaceProperties() method call at last,
but the method only process ${} type properties, not #{} dynamic properties.

Any other idea?

Thanks,
kazuchika

On Wed, Sep 10, 2008 at 5:39 PM, Dierk König <[EMAIL PROTECTED]> wrote:
> you can use the dynamic property in trailing 'steps', e.g.
> like in
>
>  storeXPath xpath:'//div[2]/a/@href', property:'result'
>  invoke '#{result}'
>
> In case you want to use the dynamic property from Groovy
> code, you have to use the webtest groovy step, e.g.
> like in
>
>  storeXPath xpath:'//div[2]', property:'result'
>  groovy (replaceProperties:true) {
>    println '#{result}'
>  }
>
> For what you can do in the groovy step
> see http://webtest.canoo.com/webtest/manual/groovy.html
>
> cheers
> Dierk
>
>
> | -----Original Message-----
> | From: Kazuchika Sekiya [mailto:[EMAIL PROTECTED]
> | Sent: Mittwoch, 10. September 2008 10:04
> | To: Dierk König
> | Cc: [email protected]
> | Subject: Re: [Webtest] how to access properties from groovy
> |
> | Dierk,
> |
> | Thanks for your help.
> | But does this notation work even in Groovy code?
> |
> | I tried:
> | --
> |   storeXPath xpath:'//div[2]', property:'result'
> |   def result = "#{result}"
> |   println result.class
> |   println result
> | --
> | but the output was:
> | --
> | class java.lang.String
> | #{result}
> | --
> |
> | Am I misunderstanding anything?
> | (again I am using pure groovy testcase, this is not in XML code)
> |
> | Thanks,
> | kazuchika
> |
> |
> | On Wed, Sep 10, 2008 at 4:43 PM, Dierk König
> | <[EMAIL PROTECTED]> wrote:
> | > with the #{propname} notation, see
> | > http://webtest.canoo.com/webtest/manual/properties.html
> | >
> | > happy testing
> | > Dierk
> | >
> | > P.S. great to see you on this list ;-)
> | >
> | > | -----Original Message-----
> | > | From: [EMAIL PROTECTED]
> | > | [mailto:[EMAIL PROTECTED] On Behalf Of
> | Kazuchika Sekiya
> | > | Sent: Mittwoch, 10. September 2008 9:27
> | > | To: [email protected]
> | > | Subject: [Webtest] how to access properties from groovy
> | > |
> | > | Hi,
> | > |
> | > | I'm trying to write some tests completely in Groovy using
> | > | WebtestCase. Most functions work fine but I have one question.
> | > |
> | > | How can I access to dynamic properties from Groovy?
> | > |
> | > | In my test class (which extends WebtestCase), I did:
> | > | --
> | > |   storeXPath xpath:'//div[2]', property:'result'
> | > | --
> | > | I want to use this "result" property value in my Groovy code.
> | > |
> | > | Thanks a lot,
> | > | kazuchika
> | > | _______________________________________________
> | > | WebTest mailing list
> | > | [email protected]
> | > | http://lists.canoo.com/mailman/listinfo/webtest
> | > |
> | >
> |
>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to