Legacy Documentation. View NUnit 3 Documentation

EventListeners (NUnit 2.4.4)

Purpose

EventListeners are able to respond to events that occur in the course of a test run, usually by recording information of some kind. Note that EventListeners called asynchronously with respect to test execution and are not able to affect the actual execution of the test.

Extension Point

Addins use the host to access this extension point by name:

	IExtensionPoint listeners = host.GetExtensionPoint( "EventListeners" );

Interface

The extension object passed to Install must implement the EventListener interface:

	public interface EventListener
	{
		void RunStarted( string name, int testCount );
		void RunFinished( TestResult result );
		void RunFinished( Exception exception );
		void TestStarted(TestName testName);
		void TestFinished(TestResult result);
		void SuiteStarted(TestName testName);
		void SuiteFinished(TestResult result);
		void UnhandledException( Exception exception );
		void TestOutput(TestOutput testOutput);
	}

You must provide all the methods, but the body may be empty for any that you have no need of.