[Webtest] Step failure and ifStep
KLOPP Gerald
webtest@lists.canoo.com
Mon, 16 Jan 2006 15:05:19 +0100
This is not working because a new web test has to be defined in the
'nonLinkTests' and 'linkTests' targets.
So, the 'invoke' target has to be called again.
-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On Behalf Of Paul King
Sent: 16 January 2006 12:16
To: webtest@gate2.canoo.com
Subject: Re: [Webtest] Step failure and ifStep
You could try something like:
<target name=3D"main" depends=3D"checkLink,nonLinkTests,linkTests"/>
<target name=3D"checkLink">
<webtest name=3D"various fail tests">
<config ...
failureProperty=3D"checkLinkFailure"
haltOnFailure=3D"false"/>
<steps>
<invoke url=3D"..."/>
<verifyText text=3D"link to check">
</steps>
</webtest>
</target>
<target name=3D"nonLinkTests" if=3D"checkLinkFailure">
<!-- non link tests go here -->
</target>
<target name=3D"linkTests" unless=3D"checkLinkFailure">
<!-- link tests go here -->
</target>
KLOPP Gerald wrote:
> Hi,
> =20
> I've already posted a message untitled 'click link only if it exists'=20
> but I think the problem is more general.
> Sometimes I want to execute a step and, if it fails, execute specific=20
> other steps
> =20
> For example :
> <verifyText text=3D"text to check">
> <ifStep test=3D"haltonfail.property">
> <!-- Steps to execute if verifyText fails -->
> </ifStep>
> =20
> Setting the 'haltonerror' and 'haltonfail' properties of the 'config'=20
> task to false doesn't resolve the problem because the next step is
never=20
> executed.
> In the example, if the verifyText fails, the ifStep is never reached.
> =20
> - One possible solution could be to refine the 'haltonfail' property
and=20
> to replace it with one like the following :
> property 'onfail' with the values :
> - 'nextWebTest' : processes the next web test if one step fails,=20
> equivalent to haltonfail=3D'false',
> - 'nextStep' : processes the next step if one step fails
> - 'halt' : stops the build, equivalent to haltonfail=3D'true'
> =20
> - One other solution could be to modify the verifyXXX steps and have
the=20
> possibility to store the result of the step in a property instead of
halting
> Example :
> <verifyText failProperty=3D"fail"
> text=3D"text to check">
> <ifStep test=3D"fail">
> <!-- Steps to execute if verifyText fails -->
> </ifStep>
> =20
> - One other solution could be to modify the ifStep and have the=20
> possibility to specify the test inside the target.
> The test is true if the task executed doesn't fail
> Example :
> <ifStep>
> <test>
> <verifyText text=3D"text to check">
> </test>
> <!-- Steps to execute if verifyText fails -->
> </ifStep>
> =20
> =20
> What do you think?
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest