Quantcast
Channel: Reza's Weblog
Viewing all articles
Browse latest Browse all 50

Send email when JUnits fails using ant

$
0
0

In your junit tag you at least need these attributes: haltonfailure="false" haltonerror="false".

This is the portion of script to call junit and see if it is failed and then send email:

 

<target name="junittest">
        ...
    <junit haltonfailure="false" haltonerror="false"
            errorproperty="test.error" failureproperty="test.error"
        ....
    </junit>

    <!--behaves conditionally-->
    <antcall target="sendMail"/>
       
</target>

<target name="sendMail" if="test.error">
        <mail mailhost="${mailhost}"
              mailport="${mailport}"
              failonerror="false"
              from="me-AT-me-DOT-com"
              tolist="${mailAddresses}"
              subject="${subject}"
              files="${file}"/>   
</target>

 


Viewing all articles
Browse latest Browse all 50

Trending Articles