Class XunitTestAssemblyRunnerBase<TContext, TTestAssembly, TTestCollection, TTestCase>
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
TContextTTestAssemblyTTestCollectionTTestCase
- 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
ctxtTContextThe context that describes the current test assembly
Returns
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
ctxtTContextThe context that describes the current test assembly
summaryRunSummaryThe execution summary for the test assembly
Returns
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
ctxtTContextThe context that describes the current test assembly
Returns
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
ctxtTContextThe 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
ctxtTContextThe context that describes the current test assembly
testCollectionTTestCollectionThe test collection that is being run.
testCasesIReadOnlyCollection<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
ctxtTContextThe context that describes the current test assembly
exceptionExceptionThe 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.