using System; using System.Collections; using System.IO; using System.Threading; namespace NUnit.Core { /// /// The TestRunner Interface is allows client code, such as the NUnit console and /// gui runners, to load and run tests. This is the lowest level interface generally /// supported for running tests and is implemented by the RemoteTestRunner class in /// the NUnit core as well as by other classes running on the client side. /// /// The Load family of methods is used to load a suite of tests from one or more /// assemblies, returning the resulting test suite to the caller. /// /// The CountTestCases family of methods returns the number of test cases in the /// loaded suite, either in its entirety or by taking a subset of tests as roots. /// /// The Run family of methods performs a test run synchronously, returning a TestResult /// or TestResult[] to the caller. If provided, an EventListener interface will be /// notified of significant events in the running of the tests. /// /// The RunTest family of methods uses the same set of signatures as Run but operates /// asynchronously. The final result of the run may be obtained through the user of an /// EventListener or through the Results property. /// public interface TestRunner { #region Properties /// /// IsTestRunning indicates whether a test is in progress. MayTo retrieve the /// results from an asynchronous test run, wait till IsTestRunning is false. /// // bool IsTestRunning // { // get; // } Version FrameworkVersion { get; } /// /// Setting to show a header line for each test case in /// the console output. /// bool DisplayTestLabels { get; set; } /// /// Results from the last test run /// TestResult[] Results { get; } /// /// First (or only) result from the last test run /// TestResult Result { get; } #endregion /// /// Load all tests from an assembly /// /// The assembly from which tests are to be loaded Test Load( string assemblyName ); /// /// Load a particular test in an assembly /// /// The assembly from which tests are to be loaded /// The name of the test fixture or suite to be loaded Test Load( string assemblyName, string testName ); /// /// Load multiple assemblies /// /// The project name to use for the root test node /// The assemblies from which tests are to be loaded Test Load( string projectName, string[] assemblies ); /// /// Load a particular test in a set of assemblies /// /// The project name to use for the root test node /// The assemblies from which tests are to be loaded /// The name of the test fixture or suite to be loaded Test Load( string projectName, string[] assemblies, string testName ); /// /// Unload all tests previously loaded /// void Unload(); void SetFilter( IFilter filter ); /// /// Count test cases previously loaded /// /// The number of test cases found int CountTestCases(); /// /// Count Test Cases under a given test name /// /// The name of a test case, fixture or suite /// The number of test cases found int CountTestCases(string testName ); /// /// Count test cases starting at a set of roots /// /// An array of names of test cases, fixtures or suites /// The number of test cases found int CountTestCases(string[] testNames); /// /// Get the collectiion of categories used by the runner; /// /// ICollection GetCategories(); /// /// Run the loaded tests using a test filter /// // TestResult Run(NUnit.Core.EventListener listener, IFilter filter); /// /// Run all loaded tests and return a test result. The test is run synchronously, /// and the listener interface is notified as it progresses. /// /// Interface to receive EventListener notifications. TestResult Run(NUnit.Core.EventListener listener); /// /// Run a particular loaded test and return a test result. The test is run /// synchronously and the listener interface is notified as it progresses. /// /// Interface to receive EventListener notifications /// The name of the test case, fixture or suite to be run TestResult Run(NUnit.Core.EventListener listener, string testName); /// /// Run a set of loaded tests and return a set of results. The test is run /// synchronously and the listener interface is notified as it progresses. /// /// Interface to receive EventListener notifications /// The names of the test cases, fixtures or suites to be run TestResult[] Run(NUnit.Core.EventListener listener, string[] testNames); /// /// Run all loaded tests. The test is run asynchronously and the listener /// interface is notified as it progresses. /// /// Interface to an object to receive EventListener notifications void RunTest(NUnit.Core.EventListener listener); /// /// Run a particular loaded test. The test is run asynchronously and the /// listener interface is notified as it progresses. /// /// Interface to an object to receive EventListener notifications /// The name of the test case, fixture or suite to be run void RunTest(NUnit.Core.EventListener listener, string testName); /// /// Run a set of loaded tests. The tests are run asynchronously and the /// listener interface is notified as it progresses. /// /// Interface to an object to receive EventListener notifications /// The names of the test cases, fixtures or suites to be run void RunTest(NUnit.Core.EventListener listener, string[] testNames); void CancelRun(); void Wait(); } }