Reputation: 3632
I have a testsuite with over 8000 tests and it's getting really hard seeing which tests broke between code changes (these test cases are queries that were automatically extracted from some log files).
Is there a simple way to get the list of failing tests for a NUnit run? Ideally, I'd like to compare which tests were affected between runs.
Upvotes: 2
Views: 2061
Reputation: 18393
You should be able to get the results from a simple xslt translation from NUnit's Xml output.
Continuous integration tools like CruiseControl have XSLT translations already built for this.
https://github.com/ccnet/CruiseControl.NET/blob/master/project/xsl/AlternativeNUnitDetails.xsl
Upvotes: 1
Reputation: 1192
You can implement 'NUnit.Core.Extensibility.IAddin' and 'NUnit.Core.EventListener'. So you can manipulate the results of your tests. The NUnit (2.5 or higher) will automatically load your class that implements the methods of "IAddin."
Like that:
using System;
using System.Text;
using NUnit.Core.Extensibility;
using NUnit.Core;
namespace YourNUnitAddIns
{
/// <summary>
/// Coleta informacoes da execucao do NUnit.
/// </summary>
[NUnitAddin(
Name="CollectNUnitFailAddIn",
Description="do something",
Type=ExtensionType.Core)]
public class CollectNUnitFailAddIn : IAddin, EventListener
{
#region IAddin Members
public bool Install(IExtensionHost host)
{
IExtensionPoint suiteBuilders = host.GetExtensionPoint("SuiteBuilders");
IExtensionPoint testBuilders = host.GetExtensionPoint("TestCaseBuilders");
IExtensionPoint events = host.GetExtensionPoint("EventListeners");
if (events == null)
return false;
events.Install(this);
return true;
}
#endregion
#region EventListener Members
public void RunFinished(Exception exception)
{
//do something here.
}
public void RunFinished(TestResult result)
{
//do something here.
}
public void RunStarted(string name, int testCount)
{
//do something here.
}
public void SuiteFinished(TestResult result)
{
//do something here.
}
public void SuiteStarted(TestName testName)
{
//do something here.
}
public void TestFinished(TestResult result)
{
//do something here.
}
public void TestOutput(TestOutput testOutput)
{
//do something here.
}
public void TestStarted(TestName testName)
{
//do something here.
}
public void UnhandledException(Exception exception)
{
//do something here.
}
#endregion
}
}
Upvotes: 3