2 using System.Collections;
4 using System.Threading;
9 /// The TestRunner Interface is allows client code, such as the NUnit console and
10 /// gui runners, to load and run tests. This is the lowest level interface generally
11 /// supported for running tests and is implemented by the RemoteTestRunner class in
12 /// the NUnit core as well as by other classes running on the client side.
14 /// The Load family of methods is used to load a suite of tests from one or more
15 /// assemblies, returning the resulting test suite to the caller.
17 /// The CountTestCases family of methods returns the number of test cases in the
18 /// loaded suite, either in its entirety or by taking a subset of tests as roots.
20 /// The Run family of methods performs a test run synchronously, returning a TestResult
21 /// or TestResult[] to the caller. If provided, an EventListener interface will be
22 /// notified of significant events in the running of the tests.
24 /// The RunTest family of methods uses the same set of signatures as Run but operates
25 /// asynchronously. The final result of the run may be obtained through the user of an
26 /// EventListener or through the Results property.
28 public interface TestRunner
33 /// IsTestRunning indicates whether a test is in progress. MayTo retrieve the
34 /// results from an asynchronous test run, wait till IsTestRunning is false.
41 Version FrameworkVersion
47 /// Setting to show a header line for each test case in
48 /// the console output.
50 bool DisplayTestLabels
56 /// Results from the last test run
64 /// First (or only) result from the last test run
74 /// Load all tests from an assembly
76 /// <param name="assemblyName">The assembly from which tests are to be loaded</param>
77 Test Load( string assemblyName );
80 /// Load a particular test in an assembly
82 /// <param name="assemblyName">The assembly from which tests are to be loaded</param>
83 /// <param name="testName">The name of the test fixture or suite to be loaded</param>
84 Test Load( string assemblyName, string testName );
87 /// Load multiple assemblies
89 /// <param name="projectName">The project name to use for the root test node</param>
90 /// <param name="assemblies">The assemblies from which tests are to be loaded</param>
91 Test Load( string projectName, string[] assemblies );
94 /// Load a particular test in a set of assemblies
96 /// <param name="projectName">The project name to use for the root test node</param>
97 /// <param name="assemblies">The assemblies from which tests are to be loaded</param>
98 /// <param name="testName">The name of the test fixture or suite to be loaded</param>
99 Test Load( string projectName, string[] assemblies, string testName );
102 /// Unload all tests previously loaded
106 void SetFilter( IFilter filter );
109 /// Count test cases previously loaded
111 /// <returns>The number of test cases found</returns>
112 int CountTestCases();
115 /// Count Test Cases under a given test name
117 /// <param name="testName">The name of a test case, fixture or suite</param>
118 /// <returns>The number of test cases found</returns>
119 int CountTestCases(string testName );
122 /// Count test cases starting at a set of roots
124 /// <param name="testNames">An array of names of test cases, fixtures or suites</param>
125 /// <returns>The number of test cases found</returns>
126 int CountTestCases(string[] testNames);
129 /// Get the collectiion of categories used by the runner;
131 /// <returns></returns>
132 ICollection GetCategories();
135 /// Run the loaded tests using a test filter
137 // TestResult Run(NUnit.Core.EventListener listener, IFilter filter);
140 /// Run all loaded tests and return a test result. The test is run synchronously,
141 /// and the listener interface is notified as it progresses.
143 /// <param name="listener">Interface to receive EventListener notifications.</param>
144 TestResult Run(NUnit.Core.EventListener listener);
147 /// Run a particular loaded test and return a test result. The test is run
148 /// synchronously and the listener interface is notified as it progresses.
150 /// <param name="listener">Interface to receive EventListener notifications</param>
151 /// <param name="testName">The name of the test case, fixture or suite to be run</param>
152 TestResult Run(NUnit.Core.EventListener listener, string testName);
155 /// Run a set of loaded tests and return a set of results. The test is run
156 /// synchronously and the listener interface is notified as it progresses.
158 /// <param name="listener">Interface to receive EventListener notifications</param>
159 /// <param name="testNames">The names of the test cases, fixtures or suites to be run</param>
160 TestResult[] Run(NUnit.Core.EventListener listener, string[] testNames);
163 /// Run all loaded tests. The test is run asynchronously and the listener
164 /// interface is notified as it progresses.
166 /// <param name="listener">Interface to an object to receive EventListener notifications</param>
167 void RunTest(NUnit.Core.EventListener listener);
170 /// Run a particular loaded test. The test is run asynchronously and the
171 /// listener interface is notified as it progresses.
173 /// <param name="listener">Interface to an object to receive EventListener notifications</param>
174 /// <param name="testName">The name of the test case, fixture or suite to be run</param>
175 void RunTest(NUnit.Core.EventListener listener, string testName);
178 /// Run a set of loaded tests. The tests are run asynchronously and the
179 /// listener interface is notified as it progresses.
181 /// <param name="listener">Interface to an object to receive EventListener notifications</param>
182 /// <param name="testNames">The names of the test cases, fixtures or suites to be run</param>
183 void RunTest(NUnit.Core.EventListener listener, string[] testNames);