[Webtest] Accessing a variable created in a previous project

Michael Knapp webtest@lists.canoo.com
Mon, 27 Mar 2006 11:41:33 -0800


Hello,

I am trying to do the following:
Have a session where a user is assigned an ID, then have another
subsequent session where the user accesses that ID.

>From what I can tell, I have to do this in separate Ant projects  (I
tried restructuring my entire architecture to have a single top level
project, but then encountered countless other obstacles that would have
necessitated me re-writing the entire suite from scratch -- IIRC because
of what can and can't be nested...).

So, what I'm trying to do is use antWrapper calls as follows:

Session1:
<storeRegEx
      description=3D"Remember registry number"
      text=3D"gl[0-9]+[a-z]?"
      group=3D"0"
      property=3D"regNumber"=20
	  />
<storeProperty
            description=3D"convert prop type "
            name=3D"registryNumber"
            value=3D"#{regNumber}"=20
		propertyType=3D"ant"/>
<antWrapper>
<exec executable=3D"touch"> <arg
value=3D"tmp/${registry.accessLevel}.lastName.${registrantLastName.value}=
"
/></exec>
<exec  executable=3D"touch"> <arg
value=3D"tmp/${registry.accessLevel}.regNumber.${registryNumber}"
/></exec>
</antWrapper>

Session2 (separate project):
<antWrapper>
<exec executable=3D"ls" outputproperty=3D"lastName"><arg
value=3D"tmp/protected.lastName.*"/> </exec>
<exec executable=3D"ls" outputproperty=3D"regNumber"><arg
value=3D"tmp/protected.regNumber.*"/> </exec>
<echo message=3D"last name is ${lastName}"/>
</antWrapper>


Note:  in the Session1 example, I've tried -- within the antWrapper --
to access the registryNumber both with #{} and ${}.
Also, it might seem a funny way to try to store values (using a
filename, with touch and ls....);  I tried to set environment variables,
but to no avail.

I can see in my results that the #{regNumber}  does resolve to a  value
and gets assigned to registryNumber, however, looking in my tmp
diorectory I have only seen files named
protected.regNumber.${registryNumber}
Or
protected.regNumber.#{registryNumber}
=09
Also, in the echo statement form session2, it echoes 'last name is
${lastName}', without resolving the variable. (looking in the directory,
the variable has been resolved in the "touch" operation, and should be
something like "protected.lastName.Smith")

I suspect that most of this is caused by and variables being reasolved
at compile time, and dynamic variables being resolved at runtime (or in
realtime - forget the phraseology used...), but then I don't understand
how any variable could be converted from Dynamic to Ant as explained in
the docs.

In any event, if anyone has a better way of doing what I'm trying to do,
it would be appreciated.

Thanks,
Mike