7 messages in com.canoo.lists.webtestRE: [Webtest] Bug in ScriptStep?| From | Sent On | Attachments |
|---|---|---|
| Denis N. Antonioli | 22 Mar 2006 04:16 | |
| Marc Guillemot | 22 Mar 2006 04:33 | |
| Dierk Koenig | 22 Mar 2006 04:48 | |
| Denis N. Antonioli | 22 Mar 2006 05:33 | |
| Denis N. Antonioli | 23 Mar 2006 01:23 | .xml |
| Marc Guillemot | 23 Mar 2006 02:16 | |
| Dierk Koenig | 23 Mar 2006 02:34 |
| Subject: | RE: [Webtest] Bug in ScriptStep?![]() |
|---|---|
| From: | Dierk Koenig (dier...@canoo.com) |
| Date: | 03/23/2006 02:34:44 AM |
| List: | com.canoo.lists.webtest |
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: webt...@lists.canoo.com [mailto:webt...@lists.canoo.com]On Behalf Of Marc Guillemot Sent: Donnerstag, 23. Marz 2006 11:17 To: webt...@lists.canoo.com 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 WebT...@lists.canoo.com http://lists.canoo.com/mailman/listinfo/webtest





.xml