Thanks Mittie (and Marc for help when Mittie was gone). I found a
solution. Since it might be helpful to others, allow me to share it:
Objective: store key=value pairs between projects. (in my case, I
needed to create a gift registry in one webtest and access it as a
different user in a subsequent webtest). This may be a sloppy hack, but
it works for me!
Project 1:
____________
<project default="useCase"><target name="UseCase"><webtest><steps>.....
...
<-- do stuff -->
...
<-- set variables -->
<storeProperty
description="Property to store for later"
name="value1"
value="#{first_value_to_save}"
propertyType="ant"/>
<storeProperty
description="Property to store for later"
name="value2"
value="#{second_value_to_save}"
propertyType="ant"/>
<antcall target="storeVars"/>
</steps></webtest></target>
<-- store the variables as filesnames, like tmp/key_value -->
<target name="storeVars">
<exec executable="touch"> <arg value="tmp/key1_${value1}"
/></exec>
<exec executable="touch"> <arg value="tmp/key2_${value2}"
/></exec>
<-- later realized there's an ant "touch" step, but haven't changed my
code -->
</target>
</project>
Project 2:
_____________
<project default="useCase"><target name="UseCase"><webtest><steps>...
...
<-- do stuff -->
...
<-- access the variables -->
<groovy>
f = new File("./tmp");
f.eachFileMatch({m = it =~ /key1_(.*)/}) {
step.setWebtestProperty("propName1",m[0][1])
//println it //for debug
}
f.eachFileMatch({m = it =~ /key2_(.*)/}) {
step.setWebtestProperty("propName2",m[0][1])
//println it //for debug
}
</groovy>
<-- use the variables -->
<someStep
property="#{propName1}"/>
<invoke
url="/myUrl?key2=#{propName2}"/>
</steps></webtest></target></project>
Hope its of use.....
mike
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Dierk Koenig
> Sent: Saturday, April 08, 2006 10:41 AM
> To: [email protected]
> Subject: RE: [Webtest] More groovy questions/help needed
>
> Hi, I'm back.
>
> Please let me know if your questions are still open.
>
> > [groovy] groovy.lang.MissingMethodException: No signature of method
> > Script1.group() is applicable for argument types:
> > ([Ljava.lang.reflect.Method;) values: {[.......]}
> ..
> > This happens for assorted methods, and even for code I'm lifting
> > directly from
> > http://webtest-community.canoo.com/wiki/space/Groovy/GroovyStep
> > Like:
> >
> > print 'methods of step:'
> > print group(step.class.methods)
> > print 'properties of step:' print group(step.allProperties())
>
> In the examples you refer to the 'group' method gets defined
> inside the script of the Groovy Step and is therefore available.
>
> More examples are in the Canoo WebTests selftests:
> http://webtest.canoo.com/fisheye/viewrep/CanooWebtest/webtest/
> selftests/test
> s
>
> Look for the ones starting with 'G'.
>
> happy testing
> Mittie
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>
>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest