[Webtest] passing parameters between two xml files

Soula, William Soula, William" <wsoula@pointserve.com
Thu, 11 Sep 2008 06:50:16 -0500


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

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/>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F2948SGPEXCHANGEpo_
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><FONT face=3DArial color=3D#0000ff size=3D2><SP=
AN=20
class=3D889434911-11092008>Could you output the property to a temp property=
 file=20
and then read it in with the other script?</SPAN></FONT></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<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 AM<BR><B>To:<=
/B>=20
webtest@lists.canoo.com<BR><B>Subject:</B> [Webtest] passing parameters bet=
ween=20
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 parameters=20
      between two<BR>xml files.<BR>With the following script(Script a1 is x=
ml=20
      file1 and Script b1 is xml file 2):<BR><SPAN=20
      style=3D"FONT-WEIGHT: bold">Script a1:</SPAN><BR>&lt;target=20
      name=3D"main1"&gt;<BR>&nbsp;&nbsp;&nbsp; &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;scriptStep=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;{<BR>printl=
n("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;&nbsp;=20
      &nbsp;<BR>&nbsp; {<BR>&nbsp; step.setWebtestProperty('a', n1);<BR>&nb=
sp;=20
      }<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 b1:</SPAN><BR>&lt;pr=
oject=20
      name=3D"SimpleTest" basedir=3D"." &gt;<BR>&nbsp; &lt;property=20
      name=3D"webtest.home" location=3D"C:/Program Files/webtest" /&gt;<BR>=
&nbsp;=20
      &lt;import file=3D"${webtest.home}/lib/taskdef.xml"/&gt;<BR>&nbsp;&nb=
sp;=20
      &lt;ant antfile=3D"f1.xml" dir=3D"." inheritrefs=3D"true" target=3D"m=
ain"&gt;=20
      <BR>&nbsp; &lt;property name=3D"webtest.connectioninitializer"=20
      value=3D"com.canoo.webtest.security.SunJsseBaseConnectionInitializer"=
=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\cacerts" =
/&gt;=20
      <BR>&nbsp; &lt;property name=3D"webtest.truststore.passphrase"=20
      value=3D"changeit" /&gt;<BR>&nbsp; <BR>&nbsp;&nbsp; &nbsp;<BR>&nbsp;&=
nbsp;=20
      &nbsp;&lt;property name=3D"n" value=3D"wwwww"/&gt;<BR>&nbsp;&nbsp; &l=
t;!--=20
      &lt;property name=3D"a" value=3D"TEST2222"/&gt; --&gt;<BR>&nbsp; &lt;=
/ant&gt;=20
      <BR>&nbsp; &lt;target name=3D"main"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;web=
test=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;&nbsp;&nbsp=
;=20
      protocol=3D"https"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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 name=3D"ThrowExceptionOnScrip=
tError"=20
      value=3D"false"/&gt;<BR>&nbsp; &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;&nbsp;=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 "b1"<BR>script,=
by=20
      doing so,b1 is not getting executed.<BR>Thanks in=20
      Advance<BR>Lavanya<BR><BR></TD></TR></TBODY></TABLE><BR><!--2-->
<HR SIZE=3D1>
</HR>Did you know? You can CHAT without downloading messenger. <A=20
href=3D"http://in.rd.yahoo.com/tagline_webmessenger_2/*http://in.webmesseng=
er.yahoo.com/">Click=20
here</A></BODY></HTML>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB18451F2948SGPEXCHANGEpo_--