Class NUnitTestAssemblyRunner
Implementation of ITestAssemblyRunner
public class NUnitTestAssemblyRunner : ITestAssemblyRunner
- Inheritance
-
NUnitTestAssemblyRunner
- Implements
- Inherited Members
Constructors
NUnitTestAssemblyRunner(ITestAssemblyBuilder)
Initializes a new instance of the NUnitTestAssemblyRunner class.
public NUnitTestAssemblyRunner(ITestAssemblyBuilder builder)
Parameters
builder
ITestAssemblyBuilderThe builder.
Properties
DefaultLevelOfParallelism
Gets the default level of parallel execution (worker threads)
public static int DefaultLevelOfParallelism { get; }
Property Value
IsTestComplete
Indicates whether a test run is complete
public bool IsTestComplete { get; }
Property Value
IsTestLoaded
Indicates whether a test is loaded
public bool IsTestLoaded { get; }
Property Value
IsTestRunning
Indicates whether a test is running
public bool IsTestRunning { get; }
Property Value
LoadedTest
The tree of tests that was loaded by the builder
public ITest? LoadedTest { get; }
Property Value
Result
The test result, if a run has completed
public ITestResult? Result { get; }
Property Value
Methods
CountTestCases(ITestFilter)
Count Test Cases using a filter
public int CountTestCases(ITestFilter filter)
Parameters
filter
ITestFilterThe filter to apply
Returns
- int
The number of test cases found
ExploreTests(ITestFilter)
Explore the test cases using a filter
public ITest ExploreTests(ITestFilter filter)
Parameters
filter
ITestFilterThe filter to apply
Returns
- ITest
Test Assembly with test cases that matches the filter
Load(Assembly, IDictionary<string, object>)
Loads the tests found in an Assembly
public ITest Load(Assembly assembly, IDictionary<string, object> settings)
Parameters
assembly
AssemblyThe assembly to load
settings
IDictionary<string, object>Dictionary of option settings for loading the assembly
Returns
- ITest
A Test Assembly containing all loaded tests
Load(string, IDictionary<string, object>)
Loads the tests found in an Assembly
public ITest Load(string assemblyNameOrPath, IDictionary<string, object> settings)
Parameters
assemblyNameOrPath
stringFile name or path of the assembly to load
settings
IDictionary<string, object>Dictionary of option settings for loading the assembly
Returns
- ITest
A Test Assembly containing all 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.
public ITestResult Run(ITestListener listener, ITestFilter filter)
Parameters
listener
ITestListenerInterface to receive EventListener notifications.
filter
ITestFilterA test filter used to select tests to be run
Returns
- ITestResult
The test results from the run
RunAsync(ITestListener, ITestFilter)
Run selected tests asynchronously, notifying the listener interface as it progresses.
public void RunAsync(ITestListener listener, ITestFilter filter)
Parameters
listener
ITestListenerInterface to receive EventListener notifications.
filter
ITestFilterA test filter used to select tests to be run
Remarks
RunAsync is a template method, calling various abstract and virtual methods to be overridden by derived classes.
StopRun(bool)
Signal any test run that is in process to stop. Return without error if no test is running.
public void StopRun(bool force)
Parameters
force
boolIf true, kill any tests that are currently running
WaitForCompletion(int)
Wait for the ongoing run to complete.
public bool WaitForCompletion(int timeout)
Parameters
timeout
intTime to wait in milliseconds
Returns
- bool
True if the run completed, otherwise false
WrapInNUnitCallContext(Action)
This method is a no-op in .NET Standard builds.
protected void WrapInNUnitCallContext(Action action)
Parameters
action
Action
WrapInNUnitCallContext<T>(Func<T>)
This method is a no-op in .NET Standard builds.
protected T WrapInNUnitCallContext<T>(Func<T> function)
Parameters
function
Func<T>
Returns
- T
Type Parameters
T