TestExecutionContext
Helper class used to save and restore certain static or
singleton settings in the environment that affect tests
or which might be changed by the user tests.
An AdhocTestExecutionContext is created whenever a context is needed
but not available in CurrentContext. This happens when tests are run
on an ad-hoc basis or Asserts are used outside of tests.
An IsolatedContext is used when running code
that may effect the current result in ways that
should not impact the final result of the test.
A new TestExecutionContext is created with an
initially clear result, which is discarded on
exiting the context.
Gets and sets the current context.
Saves or restores the CurrentCulture
Gets or sets the current IPrincipal for the Thread.
The number of times the current test has been scheduled for execution.
Currently only being executed in a test using the RetryAttribute
Gets or sets the current test result
Gets or sets the current test
Saves or restores the CurrentUICulture
The current head of the ValueFormatter chain, copied from MsgUtils.ValueFormatter
Default tolerance value used for floating point equality
when no other tolerance is specified.
The current WorkItemDispatcher. Made public for
use by nunitlite.tests
Gets the elapsed time for running the test in seconds
Gets an enum indicating whether a stop has been requested.
If true, all tests must run on the same thread. No new thread may be spawned.
Gets a TextWriter that will send output to the current test result.
The ParallelScope to be used by tests running in this context.
For builds with out the parallel feature, it has no effect.
Gets the RandomGenerator specific to this Test
The time the current test started in Ticks
The time the current test started execution
Get or set indicator that run should stop on the first error
Gets or sets the test case timeout value
The current test object - that is the user fixture
object on which tests are being executed.
The worker that spawned the context.
For builds without the parallel feature, it is null.
Gets a list of ITestActions set by upstream tests
public TestExecutionContext()
Initializes a new instance of the TestExecutionContext class.
Initializes a new instance of the TestExecutionContext class.
Adds a new ValueFormatterFactory to the chain of formatters
Set up the execution environment to match a context.
Note that we may be running on the same thread where the
context was initially created or on a different thread.
Increments the assert count by one.
Increments the assert count by a specified amount.
Sends a message from test to listeners. This message is not kind of test output and doesn't go to test result.
Record any changes in the environment made by
the test code in the execution context so it
will be passed on to lower level tests.