[Webtest] Handling Canoo Exception in Ant

Dierk König webtest@lists.canoo.com
Sat, 8 Mar 2003 10:14:32 +0100


Hi Richard,

this depends on how you use the
haltonerror
haltonfailure
attributes in the respective config steps.

I assume you set these attributes via ant properties, such that you can set
the default value for all testSpecs and override where appropriate (nested
property tag in ant task).

I do not know a way to mimic Java´s try-catch behaviour in ant for it's
BuildException if that is what you are looking for. Anyway, setting ant
properties after test completion and conditional cleanup in following steps
(depends="cleanIfNeeded", target cleanIfNeeded unless="test.ok") may do the
trick for you.

For my own projects, I usually set both attributes above to false, let all
tests run unconditionally and look at the reporting.

While developing a specific functionalty, where I only run a small amount of
tests that are all supposed to pass, I set the attributes to true, such that
I see the any erroneous behaviour immediately.

hope that helps
Mittie

> -----Original Message-----
> From: webtest-admin@lists.canoo.com
> [mailto:webtest-admin@lists.canoo.com]On Behalf Of Richard Hill
> Sent: Freitag, 7. März 2003 00:47
> To: 'webtest@lists.canoo.com'
> Subject: [Webtest] Handling Canoo Exception in Ant
>
>
> I'm calling a series of ant files that run Canoo tests (see target "test"
> below). If the first test (test1.xml) throws an exception the parent ant
> file stops, which prevent the second test from running.
>
> What I would like to do is have the parent ant script continue on
> by calling
> test2.xml when an exception occurs in the first test. Or even
> better yet, if
> the first test throws an exception, run a cleanup task before moving on to
> the next test.
>
> How would I do this in the parent ant script?
>
> <project name="Parent Ant Script" default="usage" basedir=".">
>        .
>        .
>        .
>     <!-- Run these Canoo tests -->
>     <target name="test">
>         <ant antfile="test1.xml"/>
>         <ant antfile="test2.xml"/>
>          .
>          .
>          .
>     </target>
>        .
>        .
>        .
> </project>
>
> Thanks,
>
> - Richard
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>