Table of Contents

Class TestMethodRunner<TContext, TTestMethod, TTestCase>

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

A base class that provides default behavior when running tests in a test method.

public abstract class TestMethodRunner<TContext, TTestMethod, TTestCase> where TContext : TestMethodRunnerContext<TTestMethod, TTestCase> where TTestMethod : class, ITestMethod where TTestCase : class, ITestCase

Type Parameters

TContext

The context type used by the runner

TTestMethod

The type of the test method used by the test framework. Must derive from ITestMethod.

TTestCase

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

Inheritance
TestMethodRunner<TContext, TTestMethod, TTestCase>
Derived
Inherited Members

Constructors

TestMethodRunner()

Initializes a new instance of the TestMethodRunner<TContext, TTestMethod, TTestCase> class.

Methods

FailTestCase(TContext, TTestCase, Exception)

Override this method to fail an individual test case.

OnError(TContext, Exception)

This method is called when an exception was thrown by OnTestMethodFinished(TContext, RunSummary). By default, this sends ErrorMessage.

OnTestMethodCleanupFailure(TContext, Exception)

This method is called when an exception was thrown while cleaning up, after the test method has run. By default, this sends TestMethodCleanupFailure.

OnTestMethodFinished(TContext, RunSummary)

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

OnTestMethodStarting(TContext)

This method will be called before the test method has started running. By default, this sends TestMethodStarting. Override this to enable any extensibility related to test method start.

Run(TContext)

Runs the tests in the test method.

RunTestCase(TContext, TTestCase)

Override this method to run an individual test case.

RunTestCases(TContext, Exception?)

Runs the list of test cases. By default, it runs the cases in order, synchronously.

SetTestContext(TContext, TestEngineStatus)

Sets the current TestContext for the current test method and the given test method status.