Hi

I've just found a very un-intuitive behavior in ScriptStep: at least in groovy code, an ant property name hides a groovy variable name!

I have a webtest that defines the tthe ant property ${eventFrom}.
The test then calls this groovy code through scriptStep:

def makeDate(event) {
        // convert the string to a GregorianCalendar and returns it
        // return new GregorianCalendar(event)
}

eventFrom = makeDate(step.project.properties.eventFrom)

// in real text, extract the event date form the current response
thisEvent = makeDate('22.3.2006')

// compares two Calendar objects
assert eventFrom.before(thisEvent)



This groovy code works,  but if I change to

def eventFrom = makeDate(step.project.properties.eventFrom)

The test breaks with
"No signature of method java.lang.String.before() is applicable for argument types (java.util.GregorianCalendar ...)"

Groovy used the ant property instead of its own variable. I would expect the groovy code to take precedence over the enclosing webtest stuff, as the groovy code is the nearer scope.

Is this really the desired behavior?

How is it with other scripting language?

Best
        dna
--
Jakob's Law of the Web User Experience: Users spend most of their
time on other sites.
  -- Jakob Nielsen's Alertbox, August 22, 1999

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to