[Webtest] Handling Canoo Exception in Ant
Richard Hill
webtest@lists.canoo.com
Wed, 12 Mar 2003 16:39:32 -0800
FYI, Dale Anson from the Ant user group pointed me to Antelope which =
works
quite well.
Here's the solution that I'm using:
See the try/catch/finally task packaged with Antelope=20
(http://antelope.sourceforge.net). Then you can do:
<project name=3D"Parent Ant Script" default=3D"usage" basedir=3D".">
.
.
.
<!-- Run these Canoo tests -->
<target name=3D"test">
<try break=3D"no">
<ant antfile=3D"test1.xml"/>
<ant antfile=3D"test2.xml"/>
<catch>
<!-- failure processing here -->
</catch>
</try>
.
.
.
</target>
.
.
.
</project>
The break=3D"no" means to continue with test2 even if test1 fails. The =
catch
block will execute for each=20
failed task.
- Richard
-----Original Message-----
From: Dierk K=F6nig [mailto:dierk.koenig@canoo.com]
Sent: Saturday, March 08, 2003 1:15 AM
To: webtest@gate.canoo.com
Subject: RE: [Webtest] Handling Canoo Exception in Ant
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=B4s 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=3D"cleanIfNeeded", target cleanIfNeeded unless=3D"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=E4rz 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=3D"Parent Ant Script" default=3D"usage" basedir=3D".">
> .
> .
> .
> <!-- Run these Canoo tests -->
> <target name=3D"test">
> <ant antfile=3D"test1.xml"/>
> <ant antfile=3D"test2.xml"/>
> .
> .
> .
> </target>
> .
> .
> .
> </project>
>
> Thanks,
>
> - Richard
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest