Table of Contents

Class XunitTestCaseRunner

Namespace
Xunit.v3
Assembly
xunit.v3.core.dll

The test case runner for xUnit.net v3 tests.

public class XunitTestCaseRunner : XunitTestCaseRunnerBase<XunitTestCaseRunnerContext, IXunitTestCase, IXunitTest>
Inheritance
XunitTestCaseRunner
Inherited Members

Constructors

XunitTestCaseRunner()

Initializes a new instance of the XunitTestCaseRunner class.

protected XunitTestCaseRunner()

Properties

Instance

Gets the singleton instance of the XunitTestCaseRunner class.

public static XunitTestCaseRunner Instance { get; }

Property Value

XunitTestCaseRunner

Methods

Run(IXunitTestCase, IReadOnlyCollection<IXunitTest>, IMessageBus, ExceptionAggregator, CancellationTokenSource, string, string?, ExplicitOption, object?[])

Runs the test case.

public ValueTask<RunSummary> Run(IXunitTestCase testCase, IReadOnlyCollection<IXunitTest> tests, IMessageBus messageBus, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource, string displayName, string? skipReason, ExplicitOption explicitOption, object?[] constructorArguments)

Parameters

testCase IXunitTestCase

The test case that this invocation belongs to.

tests IReadOnlyCollection<IXunitTest>

The tests for the test case.

messageBus IMessageBus

The message bus to report run status to.

aggregator ExceptionAggregator

The exception aggregator used to run code and collect exceptions.

cancellationTokenSource CancellationTokenSource

The task cancellation token source, used to cancel the test run.

displayName string

The display name of the test case.

skipReason string

The skip reason, if the test is to be skipped.

explicitOption ExplicitOption

A flag to indicate how explicit tests should be treated.

constructorArguments object[]

The arguments to be passed to the test class constructor.

Returns

ValueTask<RunSummary>

Returns summary information about the test that was run.

Remarks

This entry point is used for both single-test (like FactAttribute and individual data rows for TheoryAttribute tests) and multi-test test cases (like TheoryAttribute when pre-enumeration is disable or the theory data was not serializable).

RunTest(XunitTestCaseRunnerContext, IXunitTest)

Override this method to run an individual test.

protected override ValueTask<RunSummary> RunTest(XunitTestCaseRunnerContext ctxt, IXunitTest test)

Parameters

ctxt XunitTestCaseRunnerContext

The context that describes the current test method

test IXunitTest

The test to be run.

Returns

ValueTask<RunSummary>

Returns summary information about the test case run.