Yes, a little explanation:

The code inside a Groovy step is a GroovyScript.

GroovyScripts need no class and main method declaration.
This convenience comes at the expense that you don't see that
you're actually in the 'run' method of a Script class.

-> no way to define fields or GroovyBean properties here.

All undeclared variables are stored in the binding.
Declared variables are local to the 'run' method.

cheers
Mittie


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Marc Guillemot
> Sent: Donnerstag, 23. Marz 2006 11:17
> To: [email protected]
> Subject: Re: [Webtest] Bug in ScriptStep?
>
>
>
> Hi Denis,
>
> I think that your
>
> def isDateInRange(event) {
>     // this statement breaks if eventTo is not a Date!
>     eventTo.after(event)
> }
>
> is faulty: it uses the variable eventTo that is not defined here.
> When your
> script contains:
>
> eventTo = makeDate(step.project.properties.eventTo)
>
> then the eventTo variable is put in the binding and can be
> retrieved in the
> isDateInRange method. When you use the def keyword
>
> def eventTo = makeDate(step.project.properties.eventTo)
>
> the variable is local (to the run() method of the script) and
> can't be seen
> in makeDate.
>
> I think therefore that the scriptStep / groovy steps behave correctly. Why
> doesn't your makeDate simply take 2 parameters?
>
> Marc.
> --
> View this message in context:
http://www.nabble.com/Bug-in-ScriptStep--t1323554.html#a3549243
Sent from the WebTest forum at Nabble.com.

_______________________________________________
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