Class TestCaseRunner<TContext, TTestCase, TTest>
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
TContextThe context type used by the runner
TTestCaseThe type of the test case used by the test framework. Must derive from ITestCase.
TTestThe 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
ctxtTContextThe context that describes the current test case
testTTestThe test to be failed.
exceptionExceptionThe 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
ctxtTContextThe context that describes the current test method
testTTestThe 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
ctxtTContextThe context that describes the current test case
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.