[Webtest] looping though suite of tests

Jason Little Jason Little <agiledood@gmail.com>
Tue, 28 Jun 2011 10:06:22 -0400


Thanks Tim,  that looks like a good solution for us.  Right now one of
the programmer created a config file and is using an Ant task to loop
through the list of sites.  I like your idea better so we can extract
that configuration into something I can manage without having to bug
the programmers...

On Tue, Jun 21, 2011 at 7:13 PM, Tim Pezarro <Tim_Pezarro@pmc-sierra.com> w=
rote:
> Jason,
>
> We use the dataDriven all the time in webtest scripts without problem.
>
> Is it possible there is a typo in the header row of your excel spreadshee=
t? This header row has the name of the properties that are to be replaced i=
n your script.
>
> Here is a working example from =A0our suite:
>
> <?xml version=3D"1.0"?>
> <!DOCTYPE project SYSTEM "../../dtd/Project.dtd">
> <project default=3D"keywords">
> =A0<target name=3D"keywords">
> =A0 =A0<dataDriven tableContainer=3D"properties/adaptec/keywords.xls">
> =A0 =A0 =A0<webtest name=3D"keyword regression test on ${domain}${page}" =
=A0>
> =A0 =A0 =A0 =A0<config
> =A0 =A0 =A0 =A0 =A0autorefresh=3D"true"
> =A0 =A0 =A0 =A0 =A0haltonerror =3D "false"
> =A0 =A0 =A0 =A0 =A0haltonfailure =3D "false"
> =A0 =A0 =A0 =A0 =A0easyajax=3D"true"
> =A0 =A0 =A0 =A0 =A0useInsecureSSL=3D"true"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0browser=3D"FF3">
> =A0 =A0 =A0 =A0 =A0<option name=3D"ThrowExceptionOnFailingStatusCode" val=
ue=3D"false"/>
> =A0 =A0 =A0 =A0 =A0<option name=3D"ThrowExceptionOnScriptError" value=3D"=
false" />
> =A0 =A0 =A0 =A0</config>
> =A0 =A0 =A0 =A0<steps>
> =A0 =A0 =A0 =A0 =A0<invoke
> =A0 =A0 =A0 =A0 =A0 =A0url=3D"${domain}${page}"
> =A0 =A0 =A0 =A0 =A0 =A0description=3D"Find keyword on ${domain}${page}" /=
>
> =A0 =A0 =A0 =A0 =A0<verifyText text=3D"${keyword.1}" />
> =A0 =A0 =A0 =A0 =A0<verifyText text=3D"${keyword.2}" />
> =A0 =A0 =A0 =A0 =A0<verifyText text=3D"${header}" />
> =A0 =A0 =A0 =A0 =A0<verifyText text=3D"${footer}" />
> =A0 =A0 =A0 =A0 =A0<not>
> =A0 =A0 =A0 =A0 =A0 =A0<verifyText text=3D"an error occurred while proces=
sing this directive" />
> =A0 =A0 =A0 =A0 =A0</not>
> =A0 =A0 =A0 =A0 =A0<verifyImages />
> =A0 =A0 =A0 =A0</steps>
> =A0 =A0 =A0</webtest>
> =A0 =A0</dataDriven>
> =A0</target>
> </project>
>
> Attached is a sample of a working excel spreadsheet for this test.
>
> Cheers,
>
> Tim Pezarro
> Manager, Web Services
> Corporate Marketing
> tim_pezarro@pmc-sierra.com
> Phone: +1-604-415-6044
> Cell: +1-604-762-1000
> Fax: +1-604-415-6602
> PMC-Sierra, Inc.
> 8555 Baxter Place
> Burnaby, BC, Canada
> V5A 4V7
>
>
>
> -----Original Message-----
> From: webtest-admin@lists.canoo.com on behalf of Jason Little
> Sent: Tue 6/21/2011 2:54 PM
> To: webtest@lists.canoo.com
> Subject: [Webtest] looping though suite of tests
>
> Hi,
>
> We're looking at Webtest to create some smoketests for our app. =A0I am
> using DataDriven to grab a list of client sites to test and then
> running multiple tests in that loop but I can't seem to get properties
> working.
>
> Alltests.xml file:
> ------------------------
>
>
> <?xml version=3D"1.0"?>
>
> <project default=3D"test">
> =A0 =A0 =A0 =A0<target name=3D"test" description=3D"runs all the tests">
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<dataDriven tableContainer=3D"WebtestConfi=
g.xls">
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0<ant antfile=3D"test_UserCanLogin.xml"/>
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</dataDriven>
>
> =A0 =A0 =A0 =A0</target>
> </project>
>
>
> test_UserCanLogin.xml file:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> <?xml version=3D"1.0"?>
>
> <!DOCTYPE project SYSTEM "../dtd/Project.dtd">
>
> <project default=3D"test">
>
> =A0 =A0 =A0 =A0<target name=3D"test">
> =A0 =A0 =A0 =A0<webtest name=3D"check ${ClientName} Login works">
>
>
> <invoke url=3D"http://${SITEIP}/login.aspx" description=3D"Go to
> ${ClientName} Login Page"/>
> <setInputField xpath=3D"//input[contains(@id,'txtUserName')]" value=3D"XX=
XXXXXX" />
> <setInputField name=3D"txtPassword" value=3D"XXXXXX" />
> <clickButton htmlId=3D"btnSubmit" />
> <verifyText text=3D"Dashboard"/>
>
> =A0 =A0 =A0 =A0</webtest>
> =A0 =A0 =A0 =A0</target>
> =A0 =A0 =A0 =A0</project>
>
>
> When the running test output is echo'd in the java console I see the
> property from the xls config file is generated "check MyClient Login
> works". =A0The actual test steps themselves show ${ClientName} instead
> of "MyClient".
>
> I'm not sure why the value from the xls file shows in <webtest> but
> not the test steps.
>
> I'm new to WebTest, any ideas or should I look at Groovy to do
> something like this? =A0(I'm not a programmer by the way...) =A0Basically
> our goal is to smoketest the same functionality for multiple client
> sites as post-deployment validation.
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
>
>
>
>