Seeing failure output with haltonfailure=true (was Re: [Webtest] continue but don't abort)

Jeff Nielsen
Thu, 18 Sep 2003 12:54:44 -0400

From: "Lynn Walton" <>
> Well, I thought it was good news that I could now use multiple testSpecs.
But I'm finding that with
> haltonfailure=false
> summary=false
> verbose=true  in config, I'm not getting any output showing that there was
a failure.
> If I have an invoke that fails it goes on to the next testSpec but gives
no indication of the failure at all. I'd like to see some output showing the
failure.  Any ideas on how I can achieve this?


I tweaked the WebTest code (
to do just the thing that you are asking about.  I followed the same pattern
used by the ant "junit" task, wherein you can specify a property to be set
if a test fails.  Here is how we use it.

1. In the config, we add the name of a property to be set in case of a
failure.  In this example, we chose the name "canoo.failure.message".

.        host="${}"
.        port="${test.port}"
.        protocol="http"
.        basepath="${test.basepath}"
.        . . .
.        haltonerror="false"
.        haltonfailure="false"
.        saveresponse="true"
.        failureProperty="canoo.failure.message"

2.  In your other ant tasks, you can use the failure property display the
failure and/or to affect conditional behavior, e.g.,

.    <target name="displayErrors" if="canoo.failure.message">
.         <echo message="${canoo.failure.message}"/>
.         <echo message="!!!!!!!!!! Houston we have a problem !!!!!!!!!!"/>
.         <echo message="!!!!!!!!!!!!!! TEST FAILED !!!!!!!!!!!!!!!!!!!!"/>
.    </target>

The code added to the TestSpecificationTask.execute() method looks like this

.        // Added by Jeff Nielsen to support saving the failure
.        String failure =
.        if ((webTestResult.isError() || webTestResult.isFailure())
.                && fConfig.getFailureProperty() != null) {
.            project.setProperty(fConfig.getFailureProperty(), failure);
.        }
.        // End added section

Jeff Nielsen
Digital Focus