Class ExecutionContext
Execution context tracking test order, parallelization, and suite state. Enables detection of order-dependent failures, parallel execution issues, and resource contention patterns.
public class ExecutionContext
- Inheritance
-
ExecutionContext
- Inherited Members
Properties
CollectionName
Framework-specific collection or fixture name. XUnit: Collection name, NUnit: Fixture name, MSTest: Test class name.
public string? CollectionName { get; set; }
Property Value
ConcurrentTestCount
Number of tests executing concurrently at the time this test started. 1 for sequential execution.
public int ConcurrentTestCount { get; set; }
Property Value
GlobalPosition
Global position across all threads (best effort in parallel scenarios). May be approximate when tests run in parallel across multiple workers.
public int? GlobalPosition { get; set; }
Property Value
- int?
PositionInSuite
Position of this test in the execution order (1-based). In parallel execution, this is the position within the thread/worker.
public int PositionInSuite { get; set; }
Property Value
PreviousTestId
Stable Test ID of the test that executed immediately before this one. Null for the first test. In parallel execution, this is per-worker.
public string? PreviousTestId { get; set; }
Property Value
PreviousTestName
Display name of the previous test for debugging.
public string? PreviousTestName { get; set; }
Property Value
PreviousTestOutcome
Outcome of the previous test (Passed, Failed, Skipped, etc.).
public TestOutcome? PreviousTestOutcome { get; set; }
Property Value
SuiteElapsedTime
Time elapsed since the test suite started executing. Useful for detecting "late in suite" failures.
public TimeSpan SuiteElapsedTime { get; set; }
Property Value
TestSuiteId
Unique identifier for this test run/session. All tests in the same run share this ID.
public string TestSuiteId { get; set; }
Property Value
ThreadId
Thread ID or Worker ID executing this test. Useful for correlating tests that share the same execution thread.
public string ThreadId { get; set; }
Property Value
TotalTestsInSuite
Total number of tests in this suite (if known). May be null if framework doesn't expose this information.
public int? TotalTestsInSuite { get; set; }
Property Value
- int?
WasParallelized
Whether this test was executed in parallel with other tests.
public bool WasParallelized { get; set; }
Property Value
WorkerId
Framework-specific worker identifier (e.g., NUnit WorkerId, XUnit Collection).
public string? WorkerId { get; set; }