Table of Contents

Class TestCollectionRunner<TContext, TTestCollection, TTestClass, TTestCase>

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

A base class that provides default behavior when running tests in a test collection. It groups the tests by test class, and then runs the individual test classes.

public abstract class TestCollectionRunner<TContext, TTestCollection, TTestClass, TTestCase> where TContext : TestCollectionRunnerContext<TTestCollection, TTestCase> where TTestCollection : class, ITestCollection where TTestClass : class, ITestClass where TTestCase : class, ITestCase

Type Parameters

TContext

The context type used by the runner

TTestCollection

The type of the test collection used by the test framework. Must derive from ITestCollection.

TTestClass

The type of the test class used by the test framework. Must derive from ITestClass.

TTestCase

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

Inheritance
TestCollectionRunner<TContext, TTestCollection, TTestClass, TTestCase>
Derived
Inherited Members

Constructors

TestCollectionRunner()

Initializes a new instance of the TestCollectionRunner<TContext, TTestCollection, TTestClass, TTestCase> class.

Methods

FailTestClass(TContext, TTestClass?, IReadOnlyCollection<TTestCase>, Exception)

Fails the tests from a test class due to an exception.

OnError(TContext, Exception)

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

OnTestCollectionCleanupFailure(TContext, Exception)

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

OnTestCollectionFinished(TContext, RunSummary)

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

OnTestCollectionStarting(TContext)

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

Run(TContext)

Runs the tests in the test collection.

RunTestClass(TContext, TTestClass?, IReadOnlyCollection<TTestCase>)

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

RunTestClasses(TContext, Exception?)

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

SetTestContext(TContext, TestEngineStatus)

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