Class NUnitTestAssemblyRunner
Implementation of ITestAssemblyRunner
Implements
Inherited Members
Namespace: NUnit.Framework.Api
Assembly: nunit.framework.dll
Syntax
public class NUnitTestAssemblyRunner : ITestAssemblyRunner
Constructors
View SourceNUnitTestAssemblyRunner(ITestAssemblyBuilder)
Initializes a new instance of the NUnitTestAssemblyRunner class.
Declaration
public NUnitTestAssemblyRunner(ITestAssemblyBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| ITestAssemblyBuilder | builder | The builder. |
Properties
View SourceDefaultLevelOfParallelism
Gets the default level of parallel execution (worker threads)
Declaration
public static int DefaultLevelOfParallelism { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsTestComplete
Indicates whether a test run is complete
Declaration
public bool IsTestComplete { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsTestLoaded
Indicates whether a test is loaded
Declaration
public bool IsTestLoaded { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsTestRunning
Indicates whether a test is running
Declaration
public bool IsTestRunning { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LoadedTest
The tree of tests that was loaded by the builder
Declaration
public ITest? LoadedTest { get; }
Property Value
| Type | Description |
|---|---|
| ITest |
Result
The test result, if a run has completed
Declaration
public ITestResult? Result { get; }
Property Value
| Type | Description |
|---|---|
| ITestResult |
Methods
View SourceCountTestCases(ITestFilter)
Count Test Cases using a filter
Declaration
public 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
public 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
Declaration
public ITest Load(Assembly assembly, IDictionary<string, object> settings)
Parameters
| Type | Name | Description |
|---|---|---|
| Assembly | assembly | The assembly to load |
| IDictionary<string, object> | settings | Dictionary of option settings for loading the assembly |
Returns
| Type | Description |
|---|---|
| ITest | A Test Assembly containing all loaded tests |
Load(string, IDictionary<string, object>)
Loads the tests found in an Assembly
Declaration
public ITest Load(string assemblyNameOrPath, IDictionary<string, object> settings)
Parameters
| Type | Name | Description |
|---|---|---|
| string | assemblyNameOrPath | File name or path of the assembly to load |
| IDictionary<string, object> | settings | Dictionary of option settings for loading the assembly |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public ITestResult Run(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 |
Returns
| Type | Description |
|---|---|
| ITestResult | The test results from the run |
RunAsync(ITestListener, ITestFilter)
Run selected tests asynchronously, notifying the listener interface as it progresses.
Declaration
public 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 |
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.
Declaration
public void StopRun(bool force)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | force | If true, kill any tests that are currently running |
WaitForCompletion(int)
Wait for the ongoing run to complete.
Declaration
public 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 |
WrapInNUnitCallContext(Action)
This method is a no-op in .NET Standard builds.
Declaration
protected void WrapInNUnitCallContext(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | action |
WrapInNUnitCallContext<T>(Func<T>)
This method is a no-op in .NET Standard builds.
Declaration
protected T WrapInNUnitCallContext<T>(Func<T> function)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<T> | function |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |