AW: AW: [Webtest] Ant Script to Fail when Test Fails
christoph.krammer@mvv.de
christoph.krammer@mvv.de
Fri, 5 Oct 2007 12:16:17 +0200
Hello Marc,
thanks again for your support.
I asked the Ant guys the same question, and they provided by a simple =
solution to this. There is a package called ant-contrib which contains =
additional tasks for Ant. This package contains the antfetch task, which =
can import properties from a subproject.
So I replaced the ant task in webtest.xml and the central build file =
with antfetch and preserved the result of the failureproperty. This way =
I can easily check whether any one test has failed.
If anyone needs further details on this method, feel free to ask ;)
Regards,
Christoph
-----Urspr=FCngliche Nachricht-----
Von: webtest-admin@lists.canoo.com =
[mailto:webtest-admin@lists.canoo.com] Im Auftrag von Marc Guillemot
Gesendet: Donnerstag, 4. Oktober 2007 07:53
An: webtest@lists.canoo.com
Betreff: Re: AW: [Webtest] Ant Script to Fail when Test Fails
Hi Christoph,
I guess that you're scripts are well structured, meaning for instance =
with a main build file and one build file per script. In this case, this =
is a Ant "feature": properties set in a sub-build don't pop up.
You can use xml tasks (from
http://www.oopsconsultancy.com/software/xmltask/) to read the results in
------------
<path id=3D"xmltask.classpath">
<fileset dir=3D"the/dir/to/xmltask.jar" includes=3D"*.jar"/> </path> =
<taskdef name=3D"xmltask"
classname=3D"com.oopsconsultancy.xmltask.ant.XmlTask"
classpathref=3D"xmltask.classpath"/>
<xmltask source=3D"${webtests.resultpath}/${webtests.results}.xml">
<copy path=3D"count(/summary/testresult)" property=3D"nbWebTests"/>
<copy path=3D"count(/summary/testresult[@successful =3D 'no'])"
property=3D"nbWebTests.failed"/>
<copy path=3D"count(/summary/testresult[@successful =3D 'yes'])"
property=3D"nbWebTests.successful"/>
</xmltask>
<echo message=3D"WebTests results: ${nbWebTests.successful} successful, =
${nbWebTests.failed} failed (total: ${nbWebTests})"/> <fail>
<condition>
<not>
<equals arg1=3D"${nbWebTests.failed}" arg2=3D"0"/>
</not>
</condition>
</fail>
------------
I'm thinking since some time to add something for this purpose directly =
in WebTest. I've now opened the issue
http://webtest-community.canoo.com/jira/browse/WT-332
Marc.
--
Blog: http://mguillem.wordpress.com
christoph.krammer@mvv.de wrote:
> Hello again,
>=20
> I figured out that this should be possible with the "failureproperty" =
of the <config> tag. But I did not get how to use this property. When I =
use
>=20
> <config
> ...
> failureproperty=3D"wt.test.failed" />
>=20
> This property does not get set in case of failed tests.
>=20
> Thanks for any help.
>=20
> Regards,
> Christoph
>=20
> -----Urspr=FCngliche Nachricht-----
> Von: webtest-admin@lists.canoo.com =
[mailto:webtest-admin@lists.canoo.com] Im Auftrag von =
christoph.krammer@mvv.de
> Gesendet: Dienstag, 2. Oktober 2007 11:58
> An: webtest@lists.canoo.com
> Betreff: [Webtest] Ant Script to Fail when Test Fails
>=20
> Hello everybody,
>=20
> I want to do different actions in the Ant script when a test fails or =
is successful (deploy the application under test to a different =
application server). But to be able to do this, I have to decide whether =
a test was successful. But the Ant script states Build Successful even =
if tests fail. Is it possible to get a Build failed message, when a =
single test fails, but still to run all tests and generate the HTML =
output.
>=20
> Thanks for any help.
>=20
> Regards,
> Christoph
>=20
> ---
> Christoph Krammer
>=20
> 24/7 IT-Services GmbH
> Luisenring 49
> 68159 Mannheim
> Germany
>=20
> christoph.krammer@mvv.de
> www.24-7-it-services.de
>=20
> 24/7 IT-SERVICES GmbH / Knooper Weg 75 / 24116 Kiel =
Handelsregister-Nr. HRB 7458, Amtsgericht Kiel
> Gesch=E4ftsf=FChrer: Dr. Dirk Bevers, Dr. Ulf Dunker =
_______________________________________________
> 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
>=20
_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest