[Webtest] Resetting between test runs

Brian O'Kelley webtest@lists.canoo.com
Mon, 5 May 2003 12:37:09 -0400


A number of my tests change the underlying database (for instance, I try to
click the "delete" link, then click the "undelete" link).

If something fails in the middle of a test (delete works, but undelete
doesn't) then my next test run will fail.

What I would like to do is to have the option to reset the database to a
certain state either before or after running my tests.

I had a few ideas for how to do this.
1. Add new tasks (eg Undelete, or Setup) that have to run as the first task
in my testspec
2. Add a generic "Setup" task that takes a classname as the argument
3. Add a generic "OnFailure" task that takes a classname as the argument
4. Add a generic class (as above) that takes a SQL statement as the argument
(don't like this as much)

Are any of these supported? Is there a better way? How hard would it be for
me to extend Canoo to make it support this concept? (I'd be happy to put in
some time to extend the framework)

I guess what I really want is a "catch" or "finally" like in Java?

Thanks in advance,
Brian