Table of Contents

Class XunitTestAssemblyRunnerBase<TContext, TTestAssembly, TTestCollection, TTestCase>

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

The test assembly runner for xUnit.net v3 tests (with overridable context).

public class XunitTestAssemblyRunnerBase<TContext, TTestAssembly, TTestCollection, TTestCase> : TestAssemblyRunner<TContext, TTestAssembly, TTestCollection, TTestCase> where TContext : XunitTestAssemblyRunnerBaseContext<TTestAssembly, TTestCase> where TTestAssembly : class, IXunitTestAssembly where TTestCollection : class, IXunitTestCollection where TTestCase : class, IXunitTestCase

Type Parameters

TContext
TTestAssembly
TTestCollection
TTestCase
Inheritance
TestAssemblyRunner<TContext, TTestAssembly, TTestCollection, TTestCase>
XunitTestAssemblyRunnerBase<TContext, TTestAssembly, TTestCollection, TTestCase>
Derived
Inherited Members

Methods

GetTestFrameworkDisplayName(TContext)

Gets the display name for the test framework. Used to populate TestAssemblyStarting during OnTestAssemblyStarting(TContext).

protected override ValueTask<string> GetTestFrameworkDisplayName(TContext ctxt)

Parameters

ctxt TContext

The context that describes the current test assembly

Returns

ValueTask<string>

OnTestAssemblyFinished(TContext, RunSummary)

This method will be called when the test assembly has finished running. By default this sends TestAssemblyFinished. Override this to enable any extensibility related to test assembly finish.

protected override ValueTask<bool> OnTestAssemblyFinished(TContext ctxt, RunSummary summary)

Parameters

ctxt TContext

The context that describes the current test assembly

summary RunSummary

The execution summary for the test assembly

Returns

ValueTask<bool>

Return true if test execution should continue; false if it should be shut down.

Remarks

This method runs during CleaningUp and any exceptions thrown will contribute to test assembly cleanup failure.

OnTestAssemblyStarting(TContext)

This method will be called before the test assembly has started running. TBy default this sends TestAssemblyStarting. Override this to enable any extensibility related to test assembly start.

protected override ValueTask<bool> OnTestAssemblyStarting(TContext ctxt)

Parameters

ctxt TContext

The context that describes the current test assembly

Returns

ValueTask<bool>

Return true if test execution should continue; false if it should be shut down.

Remarks

This method runs during Initializing and any exceptions thrown will contribute to test assembly failure (and will prevent the test assembly from running). Even if this method records exceptions, OnTestAssemblyFinished(TContext, RunSummary) will be called.

OrderTestCollections(TContext)

Orders the test collections in the assembly. By default does not re-order the test collections. Override this to provide custom test collection ordering.

protected override List<(TTestCollection Collection, List<TTestCase> TestCases)> OrderTestCollections(TContext ctxt)

Parameters

ctxt TContext

The context that describes the current test assembly

Returns

List<(TTestCollection Collection, List<TTestCase> TestCases)>

Test collections in run order (and associated, not-yet-ordered test cases).

RunTestCollection(TContext, TTestCollection, IReadOnlyCollection<TTestCase>)

Override this method to run the tests in an individual test collection.

protected override ValueTask<RunSummary> RunTestCollection(TContext ctxt, TTestCollection testCollection, IReadOnlyCollection<TTestCase> testCases)

Parameters

ctxt TContext

The context that describes the current test assembly

testCollection TTestCollection

The test collection that is being run.

testCases IReadOnlyCollection<TTestCase>

The test cases that belong to the test collection.

Returns

ValueTask<RunSummary>

Returns summary information about the tests that were run.

RunTestCollections(TContext, Exception?)

Runs the list of test collections. By default, groups the tests by collection and runs them synchronously.

protected override ValueTask<RunSummary> RunTestCollections(TContext ctxt, Exception? exception)

Parameters

ctxt TContext

The context that describes the current test assembly

exception Exception

The exception that was caused during startup; should be used as an indicator that the downstream tests should fail with the provided exception rather than going through standard execution

Returns

ValueTask<RunSummary>

Returns summary information about the tests that were run.