Hi Soula,
Thanks for your reply.
I am not particular about groovy.
U can also explain me with javascript.
A1.xml(file1)
<scriptStep description="to check alphabets" language="javascript">
n1="Hello";
step.setWebtestProperty('a', n1);
</scriptStep>
<echo message="#{a}"/>
A2.xml (file2)
<project name="SimpleTest" basedir="." default="main4" >
<property name="webtest.home" location="C:/Program Files/webtest" />
<import file="${webtest.home}/lib/taskdef.xml"/>
<property name="webtest.connectioninitializer"
value="com.canoo.webtest.security.SunJsseBaseConnectionInitializer" />
<property name="webtest.truststore.file" value="C:\Program
Files\Java\jdk1.6.0_03\jre\lib\security\cacerts" />
<property name="webtest.truststore.passphrase" value="changeit" />
<import file="C:\Program Files\webtest\functions\A1.xml" description="Import
all functionalities for a full build"/>
<target name="main4" depends="main1">
<webtest name="c2">
<config
host="abc.net"
protocol="https"
>
<header name="User-Agent" value="Mozilla/4.0"/>
<header name="Accept-Language" value="de-ch"/>
<option name="ThrowExceptionOnScriptError" value="false"/>
<option name="JavaScriptEnabled" value="true"/>
</config>
<steps>
<echo message="#{a}"/>
</steps>
</webtest>
</target>
</project>
On executing File2, file 1(A1.xml) adn File 2(A2.xml)
gets executed seperately.No link between file 1 and File 2.So the result for
File 2 is
Output:
#{a}
instead of "Hello".
Please help me on how to pass values from one Xml file to another.
Thanks in Advance
Lavanya
--- On Thu, 11/9/08, Soula, William <[EMAIL PROTECTED]> wrote:
From: Soula, William <[EMAIL PROTECTED]>
Subject: RE: [Webtest] passing parameters between two xml files
To: "[email protected]" <[email protected]>
Date: Thursday, 11 September, 2008, 8:30 PM
I was thinking along the lines of this:
file 1:
<storeProperty property="movie" value="23"/>
<echo message="movie=#{movie}" file="output.txt"/>
file2:
<property file="output.txt"/>
<echo message="${movie}"/>
Something like that should be what you want, you could also use concat. If you
want to use groovy to output to the file you can do something like below (I
don't really know groovy, sorry :)
<script language="groovy">
println("movie=#{movie}")
</script>
From: lavanya palaniswamy [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2008 7:14 AM
To: Soula, William
Cc: [email protected]
Subject: RE: [Webtest] passing parameters between two xml files
Hi Soula,
Thanks for replying.
I am not able to pass parameters within two Xml files.
So i tried converting groovy variable to ant and then pass.
But this is not working.
As per solution passing values from main script to temp script again
means passing variables between two xml files.
Please help me with the solution other than this conversion from groovy to ant
and
passing the values.
Thanks in advance
Lavanya
--- On Thu, 11/9/08, Soula, William <[EMAIL PROTECTED]> wrote:
From: Soula, William <[EMAIL PROTECTED]>
Subject: RE: [Webtest] passing parameters between two xml files
To: "[email protected]" <[email protected]>
Date: Thursday, 11 September, 2008, 5:20 PM
Could you output the property to a temp property file and then read it in with
the other script?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of lavanya
palaniswamy
Sent: Thursday, September 11, 2008 6:25 AM
To: [email protected]
Subject: [Webtest] passing parameters between two xml files
Hi All,
Can any one help me in passing parameters between two
xml files.
With the following script(Script a1 is xml file1 and Script b1 is xml file 2):
Script a1:
<target name="main1">
<webtest name="a1">
<steps>
<scriptStep description="to check alphabets" language="groovy">
n1="${n}";
p = n1.length()
println("====>>"+p);
if(p>8)
{
println("invalid length")
}
else
{
println("one == passed")
theRegularExpression = /([a-z])/
if (n1 =~theRegularExpression)
{
step.setWebtestProperty('a', n1);
}
else
{
println("one == Failed");
}
}
</scriptStep>
Script b1:
<project name="SimpleTest" basedir="." >
<property name="webtest.home" location="C:/Program Files/webtest" />
<import file="${webtest.home}/lib/taskdef.xml"/>
<ant antfile="f1.xml" dir="." inheritrefs="true" target="main">
<property name="webtest.connectioninitializer"
value="com.canoo.webtest.security.SunJsseBaseConnectionInitializer" />
<property name="webtest.truststore.file" value="C:\Program
Files\Java\jdk1.6.0_03\jre\lib\security\cacerts" />
<property name="webtest.truststore.passphrase" value="changeit" />
<property name="n" value="wwwww"/>
<!-- <property name="a" value="TEST2222"/> -->
</ant>
<target name="main">
<webtest name="b1">
<config
host="ddddd.net"
protocol="https"
>
<header name="User-Agent" value="Mozilla/4.0"/>
<header name="Accept-Language" value="de-ch"/>
<option name="ThrowExceptionOnScriptError" value="false"/>
<option name="JavaScriptEnabled" value="true"/>
</config>
<steps>
<storeProperty
description="convert Ant to dynamic"
name="a"
value="${n}"/>
<setInputField name="name.given" value="#{a}"/>
<echo message="#{a}"/>
</steps>
</webtest>
</target>
</project>
Here am trying to call parameters from "a1" in to "b1"
script,by doing so,b1 is not getting executed.
Thanks in Advance
Lavanya
Did you know? You can CHAT without downloading messenger. Click here
Unlimited freedom, unlimited storage. Get it now
Unlimited freedom, unlimited storage. Get it now, on
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/