[Webtest] Patch for Error and Failure Properties added to the community site

Paul King webtest@lists.canoo.com
Sat, 07 Aug 2004 13:45:36 +1000


http://webtest-community.canoo.com/wiki/space/ErrorAndFailureProperties

 From the description:

This patch provides for better control of error processing. Suppose you 
have the following webtest ant script:

<target name="myTest1" depends="init">
   <testSpec name="partA">...</testspec>
   <testSpec name="partB">...</testspec>
   <cleanup .../>
</target>

<target name="myTest2" .../>

WebTest provides two possible ways to execute these steps:

    1. in the config element, set haltOnError (or haltOnFailure) to true 
in which case if partA fails, then neither partB or cleanup (or for that 
matter myTest2) will be executed and the build will terminate with 
"BUILD FAILED", or
    2. if haltOnError is set to false, then all steps execute even if 
any fail and the ant build says "BUILD SUCCESSFUL".

Various testing advocates have suggested that neither of these 
alternatives represent best practice. In fact, what is desirable is that 
all tests are carried out (including any cleanup) but then the ant build 
fails with "BUILD FAILED". The attached patches provide this 
functionality by setting a flag to indicate errors (or failures) in 
tests which can later be checked (this matches how ant's junit tasks 
implement this functionality).