Hi Jan,

with Groovy, you can directly hook into the ANT lifecycle and e.g. install a
BuildListener. That looks like a more suitable approach to me.

Something along the lines of

<groovy>
import org.apache.tools.ant.*

def mailer = [
targetFinished : { if (...) /* send mail */ }
]
project.addBuildListener(mailer as BuildListener )
</groovy>

Have look at the API of Project and BuildListener.

cheers
Dierk

Am 30.04.2009 um 14:03 schrieb <[email protected]> <[email protected] >:

Hi Everyone,

At first i want to apologize my self for my bad english =)

I use webtest for some availability tests on our Website.

I want to get a mail after one or more tests were not successful.

I'm use a simple second projekt to control the results of the first project with this mail.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE project SYSTEM "../dtd/Project.dtd">

<project default="test">

        <target name="test">

                <webtest name="Sende E-Mail">

                        <ifStep description="production tests">

                                <condition>
<invoke url="URL OF THE RESULTS"/> <verifyText description="Überprüfen ob ein fehler vorliegt" text="error'"/>
                                                   </condition>
                                 <then>
                                 <groovy>
def users = [ [name:'Bobby', email:'[email protected]'],
                                                ]
                                def ant = new AntBuilder()
                                for (user in users ) {
ant.mail(mailhost: 's030l0277.rwe.com', subject: 'Fehler gefunden!') { from(address: '[email protected] ')
                                to (address: user.email)
                                message( """Hallo ${user.name},
Webtest scheint einen Fehler gefunden zu haben:

                                ${new Date().toLocaleString()}

                                Bitte schau mal in die Results



                                """
                                )
                                } }
                                -->
                                </groovy>
                                 </then>
                                 <else>
                                 </else>
                         </ifStep>
                </webtest>
        </target>
</project>

So now i want a mail with the failed test into it.
Maybe like:
Test 4 has failed!
Test 14 has failed!

Could anyone help me?

Cheers

Jan

----------------------------------------------------------------
Vorsitzender des Aufsichtsrates: Alwin Fitting
Geschaeftsfuehrung: Chittur Ramakrishnan (Vorsitzender),
Stefan Niehusmann

Sitz der Gesellschaft: Dortmund
Eingetragen beim Amtsgericht Dortmund
Handelsregister-Nr. HR B 21222
USt.-IdNr. DE 2588 96 719



Reply via email to