[Webtest] Using storeregex to set properties
Charles Massey
webtest@lists.canoo.com
Fri, 30 Aug 2002 11:19:09 -0700
Hi,
Is there a way to use dynamic properties in another target that are assigned
by storeregex
I would like to use the storeregex task to extract a registration number so
that I can save it in my database. My problem is that even through the logs
say that the value has been assigned to the dynamic property successfully,
but I can't access it outside the <testSpec>. Is there a way to assign the
dynamic propery value to a global property?
I was able to verify that 'foo' indeed is getting set.
[testSpec] Setting dynamic property <foo> to <ransitional>
I imagine that the dynamic property syntax ( #{foo} ) is special to Canoo.
Why not use standard property values? (i.e. ${foo} to access foo's value).
Can someone help me with this? This means either I would like to be able to
use #{foo} outside of the <testSpec> or being able to set the dynamic
property #{foo} to a property that I can use in another target.
Thanks,
Charles
----
Example script follows:
<target name="register">
<testSpec name="Register new user">
&sharedConfiguration;
<steps>
<invoke
stepid="Registration page"
url="p.tf/registration"/>
<verifytitle
stepid="Registration page reached"
text="Classmates - Registration"/>
<storeregex
stepid="Extract 'ransitional'"
text="([a-z]+)"
group="0"
property="foo" />
</steps>
</testSpec>
</target>
<target name="storeRegex">
<!-- sql is used here to store the regex values from storeregex -->
</target>
<target name="printRegex" depends="register">
<echo message="foo = #{foo}"/>
<echo message="foo = ${foo}"/>
</target>
The output from printRegex is:
printRegex:
[echo] how many = #{howmany}
Property ${howmany} has not been set
[echo] how many = ${howmany}