[Webtest] passing parameters between two xml files

Soula, William Soula, William" <wsoula@pointserve.com
Thu, 11 Sep 2008 10:00:20 -0500


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F29C0SGPEXCHANGEpo_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I was thinking along the lines of this:
file 1:
<storeProperty property=3D"movie" value=3D"23"/>
<echo message=3D"movie=3D#{movie}" file=3D"output.txt"/>

file2:
<property file=3D"output.txt"/>
<echo message=3D"${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 bel=
ow (I don't really know groovy, sorry :)
<script language=3D"groovy">
    println("movie=3D#{movie}")
</script>


________________________________
From: lavanya palaniswamy [mailto:lavan.swamy@yahoo.co.in]
Sent: Thursday, September 11, 2008 7:14 AM
To: Soula, William
Cc: webtest@lists.canoo.com
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 <wsoula@pointserve.com> wrote:
From: Soula, William <wsoula@pointserve.com>
Subject: RE: [Webtest] passing parameters between two xml files
To: "webtest@lists.canoo.com" <webtest@lists.canoo.com>
Date: Thursday, 11 September, 2008, 5:20 PM

Could you output the property to a temp property file and then read it in w=
ith the other script?

________________________________
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] =
On Behalf Of lavanya palaniswamy
Sent: Thursday, September 11, 2008 6:25 AM
To: webtest@lists.canoo.com
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=3D"main1">
    <webtest name=3D"a1">

      <steps>

<scriptStep description=3D"to check alphabets" language=3D"groovy">
 n1=3D"${n}";

  p =3D n1.length()

  println("=3D=3D=3D=3D>>"+p);
if(p>8)
 {
println("invalid length")
}

else
{
println("one =3D=3D passed")
    theRegularExpression =3D /([a-z])/

  if (n1 =3D~theRegularExpression)

  {
  step.setWebtestProperty('a', n1);
  }
 else
 {
println("one =3D=3D Failed");
}

}
</scriptStep>

________________________________


Script b1:
<project name=3D"SimpleTest" basedir=3D"." >
  <property name=3D"webtest.home" location=3D"C:/Program Files/webtest" />
  <import file=3D"${webtest.home}/lib/taskdef.xml"/>
   <ant antfile=3D"f1.xml" dir=3D"." inheritrefs=3D"true" target=3D"main">
  <property name=3D"webtest.connectioninitializer" value=3D"com.canoo.webte=
st.security.SunJsseBaseConnectionInitializer" />
  <property name=3D"webtest.truststore.file" value=3D"C:\Program Files\Java=
\jdk1.6.0_03\jre\lib\security\cacerts" />
  <property name=3D"webtest.truststore.passphrase" value=3D"changeit" />


    <property name=3D"n" value=3D"wwwww"/>
   <!-- <property name=3D"a" value=3D"TEST2222"/> -->
  </ant>
  <target name=3D"main">
    <webtest name=3D"b1">
    <config
        host=3D"ddddd.net"
         protocol=3D"https"
              >
    <header name=3D"User-Agent" value=3D"Mozilla/4.0"/>
    <header name=3D"Accept-Language" value=3D"de-ch"/>

    <option name=3D"ThrowExceptionOnScriptError" value=3D"false"/>
  <option name=3D"JavaScriptEnabled" value=3D"true"/>

  </config>
   <steps>
      <storeProperty
        description=3D"convert Ant to dynamic"
        name=3D"a"
        value=3D"${n}"/>
<setInputField name=3D"name.given" value=3D"#{a}"/>
<echo message=3D"#{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<http:/=
/in.rd.yahoo.com/tagline_webmessenger_2/*http://in.webmessenger.yahoo.com/>


________________________________
________________________________
Unlimited freedom, unlimited storage. Get it now<http://in.rd.yahoo.com/tag=
line_mail_2/*http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08=
.html/>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F29C0SGPEXCHANGEpo_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.6000.16705" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>I was thinking along the lines of this:</FONT></SP=
AN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>file 1:</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;storeProperty property=3D"movie"=20
value=3D"23"/&gt;</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;echo message=3D"movie=3D#{movie}"=20
file=3D"output.txt"/&gt;</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>file2:</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;property file=3D"output.txt"/&gt;</FONT></SPAN=
></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;echo message=3D"${movie}"/&gt;</FONT></SPAN></=
DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>Something like that should be what you want, you c=
ould also=20
use concat.&nbsp; If you want to use groovy to output to the file you can d=
o=20
something like below (I don't really know groovy, sorry :)</FONT></SPAN></D=
IV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;script language=3D"groovy"&gt;</FONT></SPAN></=
DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008>&nbsp;&nbsp;&n=
bsp; <FONT=20
face=3DArial color=3D#0000ff size=3D2>println("movie=3D#{movie}")</FONT></S=
PAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2>&lt;/script&gt;</FONT></SPAN></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D998344714-11092008><FONT face=3DA=
rial=20
color=3D#0000ff size=3D2></FONT></SPAN>&nbsp;</DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> lavanya palaniswamy=20
[mailto:lavan.swamy@yahoo.co.in] <BR><B>Sent:</B> Thursday, September 11, 2=
008=20
7:14 AM<BR><B>To:</B> Soula, William<BR><B>Cc:</B>=20
webtest@lists.canoo.com<BR><B>Subject:</B> RE: [Webtest] passing parameters=
=20
between two xml files<BR></FONT><BR></DIV>
<DIV></DIV>
<TABLE cellSpacing=3D0 cellPadding=3D0 border=3D0>
  <TBODY>
  <TR>
    <TD vAlign=3Dtop>Hi Soula,<BR>Thanks for replying.<BR>I am not able to =
pass=20
      parameters within two Xml files.<BR>So i tried converting groovy vari=
able=20
      to ant and then pass.<BR>But this is not working.<BR>As per solution=
=20
      passing values from main script to temp script again<BR>means passing=
=20
      variables between two xml files.<BR>Please help me with the solution =
other=20
      than this conversion from groovy to ant and<BR>passing the=20
      values.<BR>Thanks in advance<BR>Lavanya<BR><BR><BR><BR><BR><BR><BR><B=
R>---=20
      On <B>Thu, 11/9/08, Soula, William=20
      <I>&lt;wsoula@pointserve.com&gt;</I></B> wrote:<BR>
      <BLOCKQUOTE=20
      style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,=
255) 2px solid">From:=20
        Soula, William &lt;wsoula@pointserve.com&gt;<BR>Subject: RE: [Webte=
st]=20
        passing parameters between two xml files<BR>To:=20
        "webtest@lists.canoo.com" &lt;webtest@lists.canoo.com&gt;<BR>Date:=
=20
        Thursday, 11 September, 2008, 5:20 PM<BR><BR>
        <DIV id=3Dyiv1328891058>
        <DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size=
=3D2><SPAN=20
        class=3D889434911-11092008>Could you output the property to a temp=
=20
        property file and then read it in with the other=20
        script?</SPAN></FONT></DIV><BR>
        <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dle=
ft>
        <HR tabIndex=3D-1>
        <FONT face=3DTahoma size=3D2><B>From:</B> webtest-admin@lists.canoo=
.com=20
        [mailto:webtest-admin@lists.canoo.com] <B>On Behalf Of </B>lavanya=
=20
        palaniswamy<BR><B>Sent:</B> Thursday, September 11, 2008 6:25=20
        AM<BR><B>To:</B> webtest@lists.canoo.com<BR><B>Subject:</B> [Webtes=
t]=20
        passing parameters between two xml files<BR></FONT><BR></DIV>
        <DIV></DIV>
        <TABLE cellSpacing=3D0 cellPadding=3D0 border=3D0>
          <TBODY>
          <TR>
            <TD vAlign=3Dtop>Hi All,<BR>Can any one help me in passing=20
              parameters between two<BR>xml files.<BR>With the following=20
              script(Script a1 is xml file1 and Script b1 is xml file=20
              2):<BR><SPAN style=3D"FONT-WEIGHT: bold">Script=20
              a1:</SPAN><BR>&lt;target name=3D"main1"&gt;<BR>&nbsp;&nbsp;&n=
bsp;=20
              &lt;webtest name=3D"a1"&gt;<BR>&nbsp;=20
              <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              &lt;steps&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<BR>&lt;scrip=
tStep=20
              description=3D"to check alphabets"=20
              language=3D"groovy"&gt;<BR>&nbsp;n1=3D"${n}";<BR><BR>&nbsp; p=
 =3D=20
              n1.length()<BR>&nbsp; <BR>&nbsp;=20
              println("=3D=3D=3D=3D&gt;&gt;"+p);<BR>if(p&gt;8)<BR>&nbsp;{<B=
R>println("invalid=20
              length")<BR>}<BR><BR>else<BR>{<BR>println("one =3D=3D=20
              passed")<BR>&nbsp;&nbsp;&nbsp; theRegularExpression =3D=20
              /([a-z])/<BR><BR>&nbsp; if (n1=20
              =3D~theRegularExpression)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
              &nbsp;<BR>&nbsp; {<BR>&nbsp; step.setWebtestProperty('a',=20
              n1);<BR>&nbsp; }<BR>&nbsp;else<BR>&nbsp;{<BR>println("one =3D=
=3D=20
              Failed");<BR>}<BR><BR>}<BR>&lt;/scriptStep&gt;<BR><BR>
              <HR style=3D"WIDTH: 100%; HEIGHT: 2px">
              <BR><BR><SPAN style=3D"FONT-WEIGHT: bold">Script=20
              b1:</SPAN><BR>&lt;project name=3D"SimpleTest" basedir=3D"."=20
              &gt;<BR>&nbsp; &lt;property name=3D"webtest.home"=20
              location=3D"C:/Program Files/webtest" /&gt;<BR>&nbsp; &lt;imp=
ort=20
              file=3D"${webtest.home}/lib/taskdef.xml"/&gt;<BR>&nbsp;&nbsp;=
=20
              &lt;ant antfile=3D"f1.xml" dir=3D"." inheritrefs=3D"true"=20
              target=3D"main"&gt; <BR>&nbsp; &lt;property=20
              name=3D"webtest.connectioninitializer"=20
              value=3D"com.canoo.webtest.security.SunJsseBaseConnectionInit=
ializer"=20
              /&gt;<BR>&nbsp; &lt;property name=3D"webtest.truststore.file"=
=20
              value=3D"C:\Program Files\Java\jdk1.6.0_03\jre\lib\security\c=
acerts"=20
              /&gt; <BR>&nbsp; &lt;property name=3D"webtest.truststore.pass=
phrase"=20
              value=3D"changeit" /&gt;<BR>&nbsp; <BR>&nbsp;&nbsp;=20
              &nbsp;<BR>&nbsp;&nbsp; &nbsp;&lt;property name=3D"n"=20
              value=3D"wwwww"/&gt;<BR>&nbsp;&nbsp; &lt;!-- &lt;property nam=
e=3D"a"=20
              value=3D"TEST2222"/&gt; --&gt;<BR>&nbsp; &lt;/ant&gt; <BR>&nb=
sp;=20
              &lt;target name=3D"main"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;webtes=
t=20
              name=3D"b1"&gt;<BR>&nbsp;&nbsp;&nbsp;=20
              &lt;config<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              host=3D"ddddd.net"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;=20
              protocol=3D"https"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              &gt;<BR>&nbsp;&nbsp;&nbsp; &lt;header name=3D"User-Agent"=20
              value=3D"Mozilla/4.0"/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;header=20
              name=3D"Accept-Language" value=3D"de-ch"/&gt;<BR>&nbsp;&nbsp;=
=20
              &nbsp;<BR>&nbsp;&nbsp;&nbsp; &lt;option=20
              name=3D"ThrowExceptionOnScriptError" value=3D"false"/&gt;<BR>=
&nbsp;=20
              &lt;option name=3D"JavaScriptEnabled"=20
              value=3D"true"/&gt;<BR><BR>&nbsp; &lt;/config&gt; <BR>&nbsp;&=
nbsp;=20
              &lt;steps&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              &lt;storeProperty<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
              description=3D"convert Ant to=20
              dynamic"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              name=3D"a"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
              value=3D"${n}"/&gt;<BR>&lt;setInputField name=3D"name.given"=
=20
              value=3D"#{a}"/&gt;<BR>&lt;echo=20
              message=3D"#{a}"/&gt;<BR>&lt;/steps&gt;<BR>&nbsp;&nbsp;=20
              &lt;/webtest&gt;<BR>&nbsp; &lt;/target&gt;<BR>&lt;/project&gt=
;<BR>
              <HR style=3D"WIDTH: 100%; HEIGHT: 2px">
              <BR>Here am trying to call parameters from "a1" in to=20
              "b1"<BR>script,by doing so,b1 is not getting executed.<BR>Tha=
nks=20
              in Advance<BR>Lavanya<BR><BR></TD></TR></TBODY></TABLE><BR>
        <HR SIZE=3D1>
        Did you know? You can CHAT without downloading messenger. <A=20
        href=3D"http://in.rd.yahoo.com/tagline_webmessenger_2/*http://in.we=
bmessenger.yahoo.com/"=20
        target=3D_blank rel=3Dnofollow>Click=20
here</A></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE><BR><!--2-->
<HR SIZE=3D1>
</HR>Unlimited freedom, unlimited storage. <A=20
href=3D"http://in.rd.yahoo.com/tagline_mail_2/*http://help.yahoo.com/l/in/y=
ahoo/mail/yahoomail/tools/tools-08.html/">Get=20
it now</A></BODY></HTML>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F29C0SGPEXCHANGEpo_--