[Webtest] looping though suite of tests

Jason Little Jason Little <agiledood@gmail.com>
Tue, 21 Jun 2011 17:54:55 -0400


Hi,

We're looking at Webtest to create some smoketests for our app.  I 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="1.0"?>

<project default="test">
	<target name="test" description="runs all the tests">
		<dataDriven tableContainer="WebtestConfig.xls">
								
					<ant antfile="test_UserCanLogin.xml"/>
			
		</dataDriven>
	
	</target>
</project>


test_UserCanLogin.xml file:
======================
<?xml version="1.0"?>

<!DOCTYPE project SYSTEM "../dtd/Project.dtd">

<project default="test">

	<target name="test">
	<webtest name="check ${ClientName} Login works">
		
	
<invoke url="http://${SITEIP}/login.aspx" description="Go to
${ClientName} Login Page"/>
<setInputField xpath="//input[contains(@id,'txtUserName')]" value="XXXXXXXX" />
<setInputField name="txtPassword" value="XXXXXX" />
<clickButton htmlId="btnSubmit" />
<verifyText text="Dashboard"/>
		
	</webtest>
	</target>
	</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".  The 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?  (I'm not a programmer by the way...)  Basically
our goal is to smoketest the same functionality for multiple client
sites as post-deployment validation.