1 // ***********************************************************************
2 // Copyright (c) 2009 Charlie Poole
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 // ***********************************************************************
25 #define NUNIT_FRAMEWORK
30 using System.Collections.Generic;
31 using System.Reflection;
32 using NUnit.Framework.Interfaces;
34 namespace NUnit.Framework.Api
37 /// The ITestAssemblyRunner interface is implemented by classes
38 /// that are able to execute a suite of tests loaded
41 public interface ITestAssemblyRunner
46 /// Gets the tree of loaded tests, or null if
47 /// no tests have been loaded.
49 ITest LoadedTest { get; }
52 /// Gets the tree of test results, if the test
53 /// run is completed, otherwise null.
55 ITestResult Result { get; }
58 /// Indicates whether a test has been loaded
60 bool IsTestLoaded { get; }
63 /// Indicates whether a test is currently running
65 bool IsTestRunning { get; }
68 /// Indicates whether a test run is complete
70 bool IsTestComplete { get; }
77 /// Loads the tests found in an Assembly, returning an
78 /// indication of whether or not the load succeeded.
80 /// <param name="assemblyName">File name of the assembly to load</param>
81 /// <param name="settings">Dictionary of options to use in loading the test</param>
82 /// <returns>An ITest representing the loaded tests</returns>
83 ITest Load(string assemblyName, IDictionary<string, object> settings);
86 /// Loads the tests found in an Assembly, returning an
87 /// indication of whether or not the load succeeded.
89 /// <param name="assembly">The assembly to load</param>
90 /// <param name="settings">Dictionary of options to use in loading the test</param>
91 /// <returns>An ITest representing the loaded tests</returns>
92 ITest Load(Assembly assembly, IDictionary<string, object> settings);
95 /// Count Test Cases using a filter
97 /// <param name="filter">The filter to apply</param>
98 /// <returns>The number of test cases found</returns>
99 int CountTestCases(ITestFilter filter);
102 /// Run selected tests and return a test result. The test is run synchronously,
103 /// and the listener interface is notified as it progresses.
105 /// <param name="listener">Interface to receive ITestListener notifications.</param>
106 /// <param name="filter">A test filter used to select tests to be run</param>
107 ITestResult Run(ITestListener listener, ITestFilter filter);
110 /// Run selected tests asynchronously, notifying the listener interface as it progresses.
112 /// <param name="listener">Interface to receive EventListener notifications.</param>
113 /// <param name="filter">A test filter used to select tests to be run</param>
114 void RunAsync(ITestListener listener, ITestFilter filter);
117 /// Wait for the ongoing run to complete.
119 /// <param name="timeout">Time to wait in milliseconds</param>
120 /// <returns>True if the run completed, otherwise false</returns>
121 bool WaitForCompletion(int timeout);
124 /// Signal any test run that is in process to stop. Return without error if no test is running.
126 /// <param name="force">If true, kill any test-running threads</param>
127 void StopRun(bool force);
132 Dictionary<string, ITest> GetTestcaseIDList();