Table of Contents

Class TestCaseRunner<TContext, TTestCase, TTest>

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

A base class that provides default behavior when running test cases which are assumed to result in one or more tests (that implement ITest).

public abstract class TestCaseRunner<TContext, TTestCase, TTest> : TestCaseRunnerBase<TContext, TTestCase> where TContext : TestCaseRunnerContext<TTestCase, TTest> where TTestCase : class, ITestCase where TTest : class, ITest

Type Parameters

TContext

The context type used by the runner

TTestCase

The type of the test case used by the test framework. Must derive from ITestCase.

TTest

The type of the test that is generated from the test case. Must derive from ITest.

Inheritance
TestCaseRunnerBase<TContext, TTestCase>
TestCaseRunner<TContext, TTestCase, TTest>
Derived
Inherited Members

Constructors

TestCaseRunner()

Initializes a new instance of the TestCaseRunner<TContext, TTestCase, TTest> class.

protected TestCaseRunner()

Methods

FailTest(TContext, TTest, Exception)

Override this method to fail an individual test.

protected virtual ValueTask<RunSummary> FailTest(TContext ctxt, TTest test, Exception exception)

Parameters

ctxt TContext

The context that describes the current test case

test TTest

The test to be failed.

exception Exception

The exception that was caused during startup.

Returns

ValueTask<RunSummary>

Returns summary information about the test case run.

Remarks

By default, uses XunitRunnerHelper to fail the test cases.

RunTest(TContext, TTest)

Override this method to run an individual test.

protected abstract ValueTask<RunSummary> RunTest(TContext ctxt, TTest test)

Parameters

ctxt TContext

The context that describes the current test method

test TTest

The test to be run.

Returns

ValueTask<RunSummary>

Returns summary information about the test case run.

RunTestCase(TContext, Exception?)

Override this to run the test case.

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

Parameters

ctxt TContext

The context that describes the current test case

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.