[Webtest] Re: Resetting between test runs

Jeff Nielsen webtest@lists.canoo.com
Wed, 7 May 2003 06:32:47 -0400

I altered WebTest so that it would set a property with the failure message
when a test failed, but still continue on with the ant build.  This was
because I had tasks I *always* wanted to run after the tests--the "finally"
behavior you allude to.  Using this failure property, I can perform my
cleanup tasks (other ant tasks) and then determine afterward whether a test
has failed.

I added this code to com.canoo.webtest.ant.TestSpecificationTask.execute()

.        String failure =
.        if ((webTestResult.isError() || webTestResult.isFailure())
.                && fConfig.getFailureProperty() != null) {
.            project.setProperty(fConfig.getFailureProperty(), failure);
.        }

and this code to com.canoo.webtest.engine.Configuration

.    private String fFailureProperty;
.    public String getFailureProperty() { return fFailureProperty; }
.    public void setFailureProperty(String propertyName) {
.        fFailureProperty = propertyName;
.    }

----- Original Message -----
From: "Brian O'Kelley" <brian@poindextersystems.com>
To: <webtest@gate.canoo.com>
Sent: Monday, May 05, 2003 3:36 PM
Subject: [Webtest] Re: Resetting between test runs

> In partial answer to my own question - here's what I did:
> I created a new action on my web application (I'm using struts, so I
> probably should say Action) that does the database resetting that I need.
> I call this before and after the critical tasks. This mitigates the need
> call Java classes or access the database directly.
> Now - how can I get catch/finally behavior from this?
> Brian
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest