Ioana-
I havnt used NUnit so I am not sure how to test for the failure of a test, however I dealt with a similar problem trying to handle the failure of a task or target.
Rather than using the MailLogger I embedded code in my project to handle targets and handle exceptions.
It worked really well and, I feel, gave me more granular controll over my project and its behavior. Here is an example:
<target name="run_build" >
   
   <script language="C#">
     <code>
    <![CDATA[
     public static void ScriptMain(Project p){
      try{
       p.Execute("build_xml");//execute a target on the project which compiles xml
      
      }catch(Exception e){
          p.Execute("mail_on_failure");//call a target w/mail task if a failure occured while running build_xml target.        
      }
     }
   </target>  
<target name="build_xml">
...
</target>
<target name="mail_on_failure">
...
</target>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Ioana Goga
Sent: Tuesday, November 16, 2004 2:13 AM
To: [EMAIL PROTECTED]
Subject: [Nant-users] How can Nant e-mail test owners if the test fails in NUnit2?

Hello,

 

I am using NAnt to run some units tests developed in .Net.

I save the results in .xml format. I know I can send mail from Nant, and

I can attach the entire results file.

 

What I want is some C# code or a script to parse the .xml results file and to check

if a test fails and to send e-mail only to the owner of the test and only if the test fails.

 

Are there any tasks in NAnt that can do this? Or can I call a task from NUnit which can do this?

Does anyone have some C# code to parse the .xml file and get this information?

 

And finally, what do you do with the results of NUnits when these are run from NAnt?

 

Thank you very much,

Ioana Goga

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003

Reply via email to