[Webtest] Can do any judge in webtest?

webtest@lists.canoo.com webtest@lists.canoo.com
Wed, 13 Nov 2002 10:34:04 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C28B2A.1935F8D0
Content-Type: text/plain;
	charset="GB2312"

I use either the ant <SQL> task or DBUnit to reset my database to a
consistent state.  I find that to be the only way to keep sane with all
these various tests...

Here is an example:

<target name="exportOptOutEmailsToBrowser">                                 
  <dbunit 
    driver="${sql.jdbcdriver}"          
    url="${sql.url}"          
    userid="${sql.username}"          
    password="${sql.password}">    
        <operation type="MSSQL_REFRESH" src="data/exportEmailsToBrowser.xml"
format="flat"/>
  </dbunit>
  
  <testSpec name="exportOptOutEmailsToBrowser">
    &sharedConfiguration;
    <steps>
      &invokeHome;
      <clickbutton stepid="Click link to Go To Export Email Addresses"
                label="Export Email Addresses"/>          
      <verifytitle stepid="Make sure we are on the Export Page"
                text="Export Email Addresses"/>
      &verifyNoError;
      <setinputfield stepid="set download type to browser window"
        name="downloadtype"
        value="1" />               
      <setinputfield stepid="set optout radio button"
        name="exportType"
        value="optout" />         
      <clickbutton stepid="Click link to Export Email Addresses"
                label="Export Email Addresses"/>          
      <verifytext stepid="Make sure we have not exported opted out"
              text="2exportOptInEmailsToBrowser@test.com"/>                 
      <not stepid="make sure opted out people are not included">
         <verifytext stepid="Make sure we exported good data"
                    text="1exportOptInEmailsToBrowser@test.com"/>

          <verifytext stepid="Make sure we exported good data"
              text="3exportOptInEmailsToBrowser@test.com"/>         
      </not>
    </steps>
  </testSpec>    
</target>


The dbunit just resets everything, and then loads my data.

Eric Pugh

-----Original Message-----
From: Dierk Koenig [mailto:dierk.koenig@canoo.com]
Sent: Wednesday, November 13, 2002 4:36 AM
To: webtest@lists.canoo.com
Subject: RE: [Webtest] Can do any judge in webtest?


Hi Chen,

> If exist , delete it , if not creat a
> user.

I'm not sure about the logic here...

Let's tackle it one-by-one:

> If exist , delete it

<steps>
	<!-- invoke page that displays the user -->
	<invoke .../>
	<!-- verify user is displayed, stop otherwise -->
	<verify.../>
	<!-- delete the user -->
	<clicklink .../>
</steps>

> if not create a user.

<steps>
	<!-- invoke page that displays the user -->
	<invoke .../>
	<!-- verify user is not displayed, stop otherwise -->
	<not>
		<verify.../>
	</not>
	<!-- create the user -->
	<clicklink .../>
</steps>

Although all the above is possible, I guess you are looking
for something different: a consistent state before starting
the tests.
I could not see, whether you expect no user or one user for
test setup (your logic actually "toggles" that state).
However, you can use the strategies above
for test setup through the web interface or for a trailing
cleanup. Make sure to have the <steps> contained in a
separate <testSpec>.
Whenever there is a database involved, it may be profitable to
care for test setup by calling the db directly from preceding
ant target. You may scan
the mailing list archive for e.g. use of dbunit for that
purpose.

cheers
Mittie

> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Chen Gefei
> Sent: Mittwoch, 13. November 2002 4:07
> To: webtest@lists.canoo.com
> Subject: [Webtest] Can do any judge in webtest?
>
>
>
>
>
> hi all
>
> I want to delete some user in an application , and first i want to know
> whether the user existed or not . If exist , delete it , if not creat a
> user.
>
> Can i complete those acton through webtest ? or by ant ?
>
> Thank  you all
>
>
> _________________________________________________________________
>  MSN Explorer:  http://explorer.msn.com/lccn/
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

------_=_NextPart_001_01C28B2A.1935F8D0
Content-Type: text/html;
	charset="GB2312"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DGB2312">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2654.89">
<TITLE>RE: [Webtest] Can do any judge in webtest?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>I use either the ant &lt;SQL&gt; task or DBUnit to =
reset my database to a consistent state.&nbsp; I find that to be the =
only way to keep sane with all these various tests...</FONT></P>

<P><FONT SIZE=3D2>Here is an example:</FONT>
</P>

<P><FONT SIZE=3D2>&lt;target =
name=3D&quot;exportOptOutEmailsToBrowser&quot;&gt;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;dbunit </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; =
driver=3D&quot;${sql.jdbcdriver}&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; =
url=3D&quot;${sql.url}&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; =
userid=3D&quot;${sql.username}&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; =
password=3D&quot;${sql.password}&quot;&gt;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;operation type=3D&quot;MSSQL_REFRESH&quot; =
src=3D&quot;data/exportEmailsToBrowser.xml&quot; =
format=3D&quot;flat&quot;/&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;/dbunit&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;testSpec =
name=3D&quot;exportOptOutEmailsToBrowser&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &amp;sharedConfiguration;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &lt;steps&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&amp;invokeHome;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;clickbutton =
stepid=3D&quot;Click link to Go To Export Email Addresses&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; label=3D&quot;Export Email =
Addresses&quot;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;verifytitle =
stepid=3D&quot;Make sure we are on the Export Page&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; text=3D&quot;Export Email =
Addresses&quot;/&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&amp;verifyNoError;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;setinputfield =
stepid=3D&quot;set download type to browser window&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
name=3D&quot;downloadtype&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
value=3D&quot;1&quot; =
/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;setinputfield =
stepid=3D&quot;set optout radio button&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
name=3D&quot;exportType&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
value=3D&quot;optout&quot; =
/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;clickbutton =
stepid=3D&quot;Click link to Export Email Addresses&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; label=3D&quot;Export Email =
Addresses&quot;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;verifytext =
stepid=3D&quot;Make sure we have not exported opted out&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; =
text=3D&quot;2exportOptInEmailsToBrowser@test.com&quot;/&gt;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;not =
stepid=3D&quot;make sure opted out people are not =
included&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;verifytext stepid=3D&quot;Make sure we exported good =
data&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
text=3D&quot;1exportOptInEmailsToBrowser@test.com&quot;/&gt;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp; </FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&lt;verifytext stepid=3D&quot;Make sure we exported good =
data&quot;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp; =
text=3D&quot;3exportOptInEmailsToBrowser@test.com&quot;/&gt;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/not&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &lt;/steps&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;/testSpec&gt;&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&lt;/target&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>The dbunit just resets everything, and then loads my =
data.</FONT>
</P>

<P><FONT SIZE=3D2>Eric Pugh</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Dierk Koenig [<A =
HREF=3D"mailto:dierk.koenig@canoo.com">mailto:dierk.koenig@canoo.com</A>=
]</FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, November 13, 2002 4:36 AM</FONT>
<BR><FONT SIZE=3D2>To: webtest@lists.canoo.com</FONT>
<BR><FONT SIZE=3D2>Subject: RE: [Webtest] Can do any judge in =
webtest?</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>Hi Chen,</FONT>
</P>

<P><FONT SIZE=3D2>&gt; If exist , delete it , if not creat a</FONT>
<BR><FONT SIZE=3D2>&gt; user.</FONT>
</P>

<P><FONT SIZE=3D2>I'm not sure about the logic here...</FONT>
</P>

<P><FONT SIZE=3D2>Let's tackle it one-by-one:</FONT>
</P>

<P><FONT SIZE=3D2>&gt; If exist , delete it</FONT>
</P>

<P><FONT SIZE=3D2>&lt;steps&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
invoke page that displays the user --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;invoke .../&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
verify user is displayed, stop otherwise --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;verify.../&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
delete the user --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;clicklink .../&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/steps&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&gt; if not create a user.</FONT>
</P>

<P><FONT SIZE=3D2>&lt;steps&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
invoke page that displays the user --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;invoke .../&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
verify user is not displayed, stop otherwise --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;not&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;verify.../&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;/not&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;!-- =
create the user --&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>&lt;clicklink .../&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/steps&gt;</FONT>
</P>

<P><FONT SIZE=3D2>Although all the above is possible, I guess you are =
looking</FONT>
<BR><FONT SIZE=3D2>for something different: a consistent state before =
starting</FONT>
<BR><FONT SIZE=3D2>the tests.</FONT>
<BR><FONT SIZE=3D2>I could not see, whether you expect no user or one =
user for</FONT>
<BR><FONT SIZE=3D2>test setup (your logic actually &quot;toggles&quot; =
that state).</FONT>
<BR><FONT SIZE=3D2>However, you can use the strategies above</FONT>
<BR><FONT SIZE=3D2>for test setup through the web interface or for a =
trailing</FONT>
<BR><FONT SIZE=3D2>cleanup. Make sure to have the &lt;steps&gt; =
contained in a</FONT>
<BR><FONT SIZE=3D2>separate &lt;testSpec&gt;.</FONT>
<BR><FONT SIZE=3D2>Whenever there is a database involved, it may be =
profitable to</FONT>
<BR><FONT SIZE=3D2>care for test setup by calling the db directly from =
preceding</FONT>
<BR><FONT SIZE=3D2>ant target. You may scan</FONT>
<BR><FONT SIZE=3D2>the mailing list archive for e.g. use of dbunit for =
that</FONT>
<BR><FONT SIZE=3D2>purpose.</FONT>
</P>

<P><FONT SIZE=3D2>cheers</FONT>
<BR><FONT SIZE=3D2>Mittie</FONT>
</P>

<P><FONT SIZE=3D2>&gt; -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>&gt; From: webtest-admin@lists.canoo.com</FONT>
<BR><FONT SIZE=3D2>&gt; [<A =
HREF=3D"mailto:webtest-admin@lists.canoo.com">mailto:webtest-admin@lists=
.canoo.com</A>]On Behalf Of Chen Gefei</FONT>
<BR><FONT SIZE=3D2>&gt; Sent: Mittwoch, 13. November 2002 4:07</FONT>
<BR><FONT SIZE=3D2>&gt; To: webtest@lists.canoo.com</FONT>
<BR><FONT SIZE=3D2>&gt; Subject: [Webtest] Can do any judge in =
webtest?</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; hi all</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; I want to delete some user in an application , =
and first i want to know</FONT>
<BR><FONT SIZE=3D2>&gt; whether the user existed or not . If exist , =
delete it , if not creat a</FONT>
<BR><FONT SIZE=3D2>&gt; user.</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Can i complete those acton through webtest ? or =
by ant ?</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; Thank&nbsp; you all</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; =
_________________________________________________________________</FONT>=

<BR><FONT SIZE=3D2>&gt; =C3=E2=B7=D1=CF=C2=D4=D8 MSN Explorer:&nbsp; <A =
HREF=3D"http://explorer.msn.com/lccn/" =
TARGET=3D"_blank">http://explorer.msn.com/lccn/</A></FONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
<BR><FONT SIZE=3D2>&gt; =
_______________________________________________</FONT>
<BR><FONT SIZE=3D2>&gt; WebTest mailing list</FONT>
<BR><FONT SIZE=3D2>&gt; WebTest@lists.canoo.com</FONT>
<BR><FONT SIZE=3D2>&gt; <A =
HREF=3D"http://lists.canoo.com/mailman/listinfo/webtest" =
TARGET=3D"_blank">http://lists.canoo.com/mailman/listinfo/webtest</A></F=
ONT>
<BR><FONT SIZE=3D2>&gt;</FONT>
</P>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>WebTest mailing list</FONT>
<BR><FONT SIZE=3D2>WebTest@lists.canoo.com</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://lists.canoo.com/mailman/listinfo/webtest" =
TARGET=3D"_blank">http://lists.canoo.com/mailman/listinfo/webtest</A></F=
ONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C28B2A.1935F8D0--