[Webtest] How to test multiple elements on the same page?

Dierk Konig Dierk.Koenig@canoo.com
Tue, 5 Mar 2002 21:27:25 +0100

Hi Jerry,

> We have a lot of pages that require input, with different behaviors
> expected based on the inputs, so that was the basis of my question.
> Looks like I'll have to do some copying and pasting. ;-)
> Jerry

With respect to what we tried so far, I always strive to avoid duplication
wherever possible.

If your problem is like:

setinputfield name=x value=y1
verifyXXX value=z1

and the next test is

setinputfield name=x value=y2
verifyXXX value=z2

I recommend making one module to capture the otherwise duplicated structure.

Use ANT variables to do that, like

setinputfield name=x value=${val.in}
verifyXXX value=${val.out}

Put the whole testspec and its target in a single ant file, e.g. module.xml.
Create a calling file including these task invocations:

<ant antfile="module.xml">
	<parameter name="val.in" value="y1"/>
	<parameter name="val.out" value="z1"/>
<ant antfile="module.xml">
	<parameter name="val.in" value="y2"/>
	<parameter name="val.out" value="z2"/>

If your structure is not totally identical, build a module at least for
the identical parts and test the rest separately.