1 | <!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
|
---|
2 | <html>
|
---|
3 | <!-- Standard Head Part -->
|
---|
4 | <head>
|
---|
5 | <title>NUnit - EventListeners</title>
|
---|
6 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
---|
7 | <meta http-equiv="Content-Language" content="en-US">
|
---|
8 | <link rel="stylesheet" type="text/css" href="nunit.css">
|
---|
9 | <link rel="shortcut icon" href="favicon.ico">
|
---|
10 | </head>
|
---|
11 | <!-- End Standard Head Part -->
|
---|
12 |
|
---|
13 | <body>
|
---|
14 |
|
---|
15 | <!-- Standard Header for NUnit.org -->
|
---|
16 | <div id="header">
|
---|
17 | <a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
|
---|
18 | <div id="nav">
|
---|
19 | <a href="http://www.nunit.org">NUnit</a>
|
---|
20 | <a class="active" href="index.html">Documentation</a>
|
---|
21 | </div>
|
---|
22 | </div>
|
---|
23 | <!-- End of Header -->
|
---|
24 |
|
---|
25 | <div id="content">
|
---|
26 |
|
---|
27 | <h3>EventListeners (NUnit 2.4.4)</h3>
|
---|
28 |
|
---|
29 | <h4>Purpose</h4>
|
---|
30 | <p>EventListeners are able to respond to events that occur in the course
|
---|
31 | of a test run, usually by recording information of some kind. Note that
|
---|
32 | EventListeners called asynchronously with respect to test execution and
|
---|
33 | are not able to affect the actual execution of the test.
|
---|
34 |
|
---|
35 | <h4>Extension Point</h4>
|
---|
36 | <p>Addins use the host to access this extension point by name:
|
---|
37 |
|
---|
38 | <pre>
|
---|
39 | IExtensionPoint listeners = host.GetExtensionPoint( "EventListeners" );</pre>
|
---|
40 |
|
---|
41 | <h4>Interface</h4>
|
---|
42 | <p>The extension object passed to Install must implement the EventListener interface:
|
---|
43 |
|
---|
44 | <pre>
|
---|
45 | public interface EventListener
|
---|
46 | {
|
---|
47 | void RunStarted( string name, int testCount );
|
---|
48 | void RunFinished( TestResult result );
|
---|
49 | void RunFinished( Exception exception );
|
---|
50 | void TestStarted(TestName testName);
|
---|
51 | void TestFinished(TestResult result);
|
---|
52 | void SuiteStarted(TestName testName);
|
---|
53 | void SuiteFinished(TestResult result);
|
---|
54 | void UnhandledException( Exception exception );
|
---|
55 | void TestOutput(TestOutput testOutput);
|
---|
56 | }
|
---|
57 | </pre>
|
---|
58 |
|
---|
59 | <p>You must provide all the methods, but the body may be empty for any
|
---|
60 | that you have no need of.
|
---|
61 |
|
---|
62 |
|
---|
63 | </div>
|
---|
64 |
|
---|
65 | <!-- Submenu -->
|
---|
66 | <div id="subnav">
|
---|
67 | <ul>
|
---|
68 | <li><a href="index.html">NUnit 2.5.10</a></li>
|
---|
69 | <ul>
|
---|
70 | <li><a href="getStarted.html">Getting Started</a></li>
|
---|
71 | <li><a href="assertions.html">Assertions</a></li>
|
---|
72 | <li><a href="constraintModel.html">Constraints</a></li>
|
---|
73 | <li><a href="attributes.html">Attributes</a></li>
|
---|
74 | <li><a href="runningTests.html">Running Tests</a></li>
|
---|
75 | <li><a href="extensibility.html">Extensibility</a></li>
|
---|
76 | <ul>
|
---|
77 | <li><a href="customConstraints.html">Custom Constraints</a></li>
|
---|
78 | <li><a href="nunitAddins.html">NUnit Addins</a></li>
|
---|
79 | <ul>
|
---|
80 | <li><a href="suiteBuilders.html">SuiteBuilders</a></li>
|
---|
81 | <li><a href="testcaseBuilders.html">TestcaseBuilders</a></li>
|
---|
82 | <li><a href="testDecorators.html">TestDecorators</a></li>
|
---|
83 | <li><a href="testcaseProviders.html">TestcaseProviders</a></li>
|
---|
84 | <li><a href="datapointProviders.html">DatapointProviders</a></li>
|
---|
85 | <li id="current"><a href="eventListeners.html">EventListeners</a></li>
|
---|
86 | </ul>
|
---|
87 | <li><a href="extensionTips.html">Tips for Extenders</a></li>
|
---|
88 | </ul>
|
---|
89 | <li><a href="releaseNotes.html">Release Notes</a></li>
|
---|
90 | <li><a href="samples.html">Samples</a></li>
|
---|
91 | <li><a href="license.html">License</a></li>
|
---|
92 | </ul>
|
---|
93 | </ul>
|
---|
94 | </div>
|
---|
95 | <!-- End of Submenu -->
|
---|
96 |
|
---|
97 |
|
---|
98 | <!-- Standard Footer for NUnit.org -->
|
---|
99 | <div id="footer">
|
---|
100 | Copyright © 2010 Charlie Poole. All Rights Reserved.
|
---|
101 | </div>
|
---|
102 | <!-- End of Footer -->
|
---|
103 |
|
---|
104 | </body>
|
---|
105 | </html>
|
---|