BUGFIX: when deleting directories, delete any files within them
[tfs.git] / nunit20 / core / TestRunner.cs
blobfaf929c78b1ed92f04443d5210ea0ecf5271cdfa
1 using System;
2 using System.Collections;
3 using System.IO;
4 using System.Threading;
6 namespace NUnit.Core
8 /// <summary>
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.
13 ///
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.
16 ///
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.
19 ///
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.
23 ///
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.
27 /// </summary>
28 public interface TestRunner
30 #region Properties
32 /// <summary>
33 /// IsTestRunning indicates whether a test is in progress. MayTo retrieve the
34 /// results from an asynchronous test run, wait till IsTestRunning is false.
35 /// </summary>
36 // bool IsTestRunning
37 // {
38 // get;
39 // }
41 Version FrameworkVersion
43 get;
46 /// <summary>
47 /// Setting to show a header line for each test case in
48 /// the console output.
49 /// </summary>
50 bool DisplayTestLabels
52 get; set;
55 /// <summary>
56 /// Results from the last test run
57 /// </summary>
58 TestResult[] Results
60 get;
63 /// <summary>
64 /// First (or only) result from the last test run
65 /// </summary>
66 TestResult Result
68 get;
71 #endregion
73 /// <summary>
74 /// Load all tests from an assembly
75 /// </summary>
76 /// <param name="assemblyName">The assembly from which tests are to be loaded</param>
77 Test Load( string assemblyName );
79 /// <summary>
80 /// Load a particular test in an assembly
81 /// </summary>
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 );
86 /// <summary>
87 /// Load multiple assemblies
88 /// </summary>
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 );
93 /// <summary>
94 /// Load a particular test in a set of assemblies
95 /// </summary>
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 );
101 /// <summary>
102 /// Unload all tests previously loaded
103 /// </summary>
104 void Unload();
106 void SetFilter( IFilter filter );
108 /// <summary>
109 /// Count test cases previously loaded
110 /// </summary>
111 /// <returns>The number of test cases found</returns>
112 int CountTestCases();
114 /// <summary>
115 /// Count Test Cases under a given test name
116 /// </summary>
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 );
121 /// <summary>
122 /// Count test cases starting at a set of roots
123 /// </summary>
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);
128 /// <summary>
129 /// Get the collectiion of categories used by the runner;
130 /// </summary>
131 /// <returns></returns>
132 ICollection GetCategories();
134 /// <summary>
135 /// Run the loaded tests using a test filter
136 /// </summary>
137 // TestResult Run(NUnit.Core.EventListener listener, IFilter filter);
139 /// <summary>
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.
142 /// </summary>
143 /// <param name="listener">Interface to receive EventListener notifications.</param>
144 TestResult Run(NUnit.Core.EventListener listener);
146 /// <summary>
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.
149 /// </summary>
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);
154 /// <summary>
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.
157 /// </summary>
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);
162 /// <summary>
163 /// Run all loaded tests. The test is run asynchronously and the listener
164 /// interface is notified as it progresses.
165 /// </summary>
166 /// <param name="listener">Interface to an object to receive EventListener notifications</param>
167 void RunTest(NUnit.Core.EventListener listener);
169 /// <summary>
170 /// Run a particular loaded test. The test is run asynchronously and the
171 /// listener interface is notified as it progresses.
172 /// </summary>
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);
177 /// <summary>
178 /// Run a set of loaded tests. The tests are run asynchronously and the
179 /// listener interface is notified as it progresses.
180 /// </summary>
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);
185 void CancelRun();
187 void Wait();