Method SetForTest
- Namespace
- Xunit
- Assembly
- xunit.v3.core.dll
SetForTest(ITest, TestEngineStatus, CancellationToken, TestResultState?, ITestOutputHelper?, object?)
Sets the test context for execution of a test. This assumes an existing test context already exists from which it can pull the diagnostic and internal diagnostic message sinks.
public static void SetForTest(ITest test, TestEngineStatus testStatus, CancellationToken cancellationToken, TestResultState? testState = null, ITestOutputHelper? testOutputHelper = null, object? testClassInstance = null)
Parameters
testThe test that is being executed
testStatusThe test status (valid values: Initializing, Running, and CleaningUp)
cancellationTokenCancellationTokenThe cancellation token used to cancel execution
testStateThe state of the test (only required when
testStatusis CleaningUp).testOutputHelperThe test output helper that the test can use to write output. Must be passed when
testStatusis Initializing; can benullfor other statuses (as it will be pulled from the existing test context).testClassInstanceobjectThe instance of the test class (may be
nullfor static class and before the test class has been created)