Interface ITestAssemblyRunner
The ITestAssemblyRunner interface is implemented by classes that are able to execute a suite of tests loaded from an assembly.
Namespace: NUnit.Framework.Api
Assembly: nunit.framework.dll
Syntax
public interface ITestAssemblyRunner
Properties
View SourceIsTestComplete
Indicates whether a test run is complete
Declaration
bool IsTestComplete { get; }
Property Value
Type | Description |
---|---|
bool |
IsTestLoaded
Indicates whether a test has been loaded
Declaration
bool IsTestLoaded { get; }
Property Value
Type | Description |
---|---|
bool |
IsTestRunning
Indicates whether a test is currently running
Declaration
bool IsTestRunning { get; }
Property Value
Type | Description |
---|---|
bool |
LoadedTest
Gets the tree of loaded tests, or null if no tests have been loaded.
Declaration
ITest? LoadedTest { get; }
Property Value
Type | Description |
---|---|
ITest |
Result
Gets the tree of test results, if the test run is completed, otherwise null.
Declaration
ITestResult? Result { get; }
Property Value
Type | Description |
---|---|
ITestResult |
Methods
View SourceCountTestCases(ITestFilter)
Count Test Cases using a filter
Declaration
int CountTestCases(ITestFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ITestFilter | filter | The filter to apply |
Returns
Type | Description |
---|---|
int | The number of test cases found |
ExploreTests(ITestFilter)
Explore the test cases using a filter
Declaration
ITest ExploreTests(ITestFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ITestFilter | filter | The filter to apply |
Returns
Type | Description |
---|---|
ITest | Test Assembly with test cases that matches the filter |
Load(Assembly, IDictionary<string, object>)
Loads the tests found in an Assembly, returning an indication of whether or not the load succeeded.
Declaration
ITest Load(Assembly assembly, IDictionary<string, object> settings)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to load |
IDictionary<string, object> | settings | Dictionary of options to use in loading the test |
Returns
Type | Description |
---|---|
ITest | An ITest representing the loaded tests |
Load(string, IDictionary<string, object>)
Loads the tests found in an Assembly, returning an indication of whether or not the load succeeded.
Declaration
ITest Load(string assemblyName, IDictionary<string, object> settings)
Parameters
Type | Name | Description |
---|---|---|
string | assemblyName | File name of the assembly to load |
IDictionary<string, object> | settings | Dictionary of options to use in loading the test |
Returns
Type | Description |
---|---|
ITest | An ITest representing the loaded tests |
Run(ITestListener, ITestFilter)
Run selected tests and return a test result. The test is run synchronously, and the listener interface is notified as it progresses.
Declaration
ITestResult Run(ITestListener listener, ITestFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ITestListener | listener | Interface to receive ITestListener notifications. |
ITestFilter | filter | A test filter used to select tests to be run |
Returns
Type | Description |
---|---|
ITestResult |
RunAsync(ITestListener, ITestFilter)
Run selected tests asynchronously, notifying the listener interface as it progresses.
Declaration
void RunAsync(ITestListener listener, ITestFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ITestListener | listener | Interface to receive EventListener notifications. |
ITestFilter | filter | A test filter used to select tests to be run |
StopRun(bool)
Signal any test run that is in process to stop. Return without error if no test is running.
Declaration
void StopRun(bool force)
Parameters
Type | Name | Description |
---|---|---|
bool | force | If true, kill any test-running threads |
WaitForCompletion(int)
Wait for the ongoing run to complete.
Declaration
bool WaitForCompletion(int timeout)
Parameters
Type | Name | Description |
---|---|---|
int | timeout | Time to wait in milliseconds |
Returns
Type | Description |
---|---|
bool | True if the run completed, otherwise false |