Class XunitTestClassRunnerBase<TContext, TTestClass, TTestMethod, TTestCase>
The test class runner for xUnit.net v3 tests (with overridable context).
public abstract class XunitTestClassRunnerBase<TContext, TTestClass, TTestMethod, TTestCase> : TestClassRunner<TContext, TTestClass, TTestMethod, TTestCase> where TContext : XunitTestClassRunnerBaseContext<TTestClass, TTestCase> where TTestClass : class, IXunitTestClass where TTestMethod : class, IXunitTestMethod where TTestCase : class, IXunitTestCase
Type Parameters
TContextTTestClassTTestMethodTTestCase
- Inheritance
-
TestClassRunner<TContext, TTestClass, TTestMethod, TTestCase>XunitTestClassRunnerBase<TContext, TTestClass, TTestMethod, TTestCase>
- Derived
- Inherited Members
Methods
CreateTestClassConstructorArguments(TContext)
Creates the arguments for the test class constructor. By default just returns an empty set of arguments. Override to find the arguments for the constructor.
protected override ValueTask<object?[]> CreateTestClassConstructorArguments(TContext ctxt)
Parameters
ctxtTContextThe context that describes the current test class
Returns
Remarks
This method runs during Initializing and any exceptions thrown will contribute to test class failure (and will prevent the test class from running)
FormatConstructorArgsMissingMessage(TContext, ConstructorInfo, IReadOnlyList<Tuple<int, ParameterInfo>>)
Gets the message to be used when the constructor is missing arguments.
protected virtual string FormatConstructorArgsMissingMessage(TContext ctxt, ConstructorInfo constructor, IReadOnlyList<Tuple<int, ParameterInfo>> unusedArguments)
Parameters
ctxtTContextThe context that describes the current test class
constructorConstructorInfoThe constructor that was selected
unusedArgumentsIReadOnlyList<Tuple<int, ParameterInfo>>The arguments that had no matching parameter values
Returns
GetConstructorArgument(TContext, ConstructorInfo, int, ParameterInfo)
Tries to supply a test class constructor argument.
protected virtual ValueTask<object?> GetConstructorArgument(TContext ctxt, ConstructorInfo constructor, int index, ParameterInfo parameter)
Parameters
ctxtTContextThe context that describes the current test class
constructorConstructorInfoThe constructor that will be used to create the test class.
indexintThe parameter index.
parameterParameterInfoThe parameter information.
Returns
OnTestClassFinished(TContext, RunSummary)
This method will be called when the test class has finished running. By default, this sends TestClassFinished. Override this to enable any extensibility related to test class finish.
protected override ValueTask<bool> OnTestClassFinished(TContext ctxt, RunSummary summary)
Parameters
ctxtTContextThe context that describes the current test class
summaryRunSummaryThe execution summary for the test class
Returns
Remarks
This method runs during CleaningUp and any exceptions thrown will contribute to test class cleanup failure.
OnTestClassStarting(TContext)
This method will be called before the test class has started running. By default, this sends TestClassStarting. Override this to enable any extensibility related to test class start.
protected override ValueTask<bool> OnTestClassStarting(TContext ctxt)
Parameters
ctxtTContextThe context that describes the current test class
Returns
Remarks
This method runs during Initializing and any exceptions thrown will contribute to test class failure (and will prevent the test class from running). Even if this method records exceptions, OnTestClassFinished(TContext, RunSummary) will be called.
OrderTestCases(TContext)
Orders the test cases in the class. By default does not re-order the test cases. Override this to provide custom test case ordering.
protected override IReadOnlyCollection<TTestCase> OrderTestCases(TContext ctxt)
Parameters
ctxtTContextThe context that describes the current test class
Returns
- IReadOnlyCollection<TTestCase>
Remarks
This method runs during Running and any exceptions thrown will contribute to test class failure
SelectTestClassConstructor(TContext)
Selects the test constructor.
protected virtual ConstructorInfo? SelectTestClassConstructor(TContext ctxt)
Parameters
ctxtTContextThe context that describes the current test class
Returns
SetTestContext(TContext, TestEngineStatus)
Sets the current TestContext for the current test class and the given test class status.
protected override void SetTestContext(TContext ctxt, TestEngineStatus testClassStatus)
Parameters
ctxtTContextThe context that describes the current test class
testClassStatusTestEngineStatusThe current test class status.
Remarks
This method must never throw. Behavior is undefined if it does. Instead, exceptions that
occur should be recorded in the aggregator in ctxt and will be reflected
in a way that's appropriate based on when this method is called.