Method OnTestStarting
- Namespace
- Xunit.v3
- Assembly
- xunit.v3.core.dll
OnTestStarting(TContext)
This method is called just before the test is run. By default, this sends TestStarting. Override this to enable any extensibility related to test start.
protected virtual ValueTask<bool> OnTestStarting(TContext ctxt)
Parameters
ctxtTContextThe context that describes the current test
Returns
Remarks
This method runs during Initializing and any exceptions thrown will contribute to test failure (and will prevent the test from running). Even if this method records exceptions, OnTestFinished(TContext, decimal, string, string[]?, IReadOnlyDictionary<string, TestAttachment>?) will be called.
OnTestStarting(TContext, bool, int)
This is a helper that allows passing explicit and timeout values, since those are not part of the core object model.
protected ValueTask<bool> OnTestStarting(TContext ctxt, bool @explicit, int timeout)
Parameters
ctxtTContextThe context that describes the current test
explicitboolA flag which indicates whether this is an explicit test
timeoutintThe timeout for running this test