Table of Contents

Class NUnitTestAssemblyRunner

Namespace
NUnit.Framework.Api
Assembly
nunit.framework.dll

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 ITestAssemblyBuilder

The builder.

Properties

DefaultLevelOfParallelism

Gets the default level of parallel execution (worker threads)

public static int DefaultLevelOfParallelism { get; }

Property Value

int

IsTestComplete

Indicates whether a test run is complete

public bool IsTestComplete { get; }

Property Value

bool

IsTestLoaded

Indicates whether a test is loaded

public bool IsTestLoaded { get; }

Property Value

bool

IsTestRunning

Indicates whether a test is running

public bool IsTestRunning { get; }

Property Value

bool

LoadedTest

The tree of tests that was loaded by the builder

public ITest? LoadedTest { get; }

Property Value

ITest

Result

The test result, if a run has completed

public ITestResult? Result { get; }

Property Value

ITestResult

Methods

CountTestCases(ITestFilter)

Count Test Cases using a filter

public int CountTestCases(ITestFilter filter)

Parameters

filter ITestFilter

The 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 ITestFilter

The 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 Assembly

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

Load(string, IDictionary<string, object>)

Loads the tests found in an Assembly

public ITest Load(string assemblyNameOrPath, IDictionary<string, object> settings)

Parameters

assemblyNameOrPath string

File 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 ITestListener

Interface to receive EventListener notifications.

filter ITestFilter

A 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 ITestListener

Interface to receive EventListener notifications.

filter ITestFilter

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.

public void StopRun(bool force)

Parameters

force bool

If true, kill any tests that are currently running

WaitForCompletion(int)

Wait for the ongoing run to complete.

public bool WaitForCompletion(int timeout)

Parameters

timeout int

Time 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