Class TestContext
- Namespace
- Xping.Sdk.Core.Components
- Assembly
- Xping.Sdk.Core.dll
The TestContext class is responsible for maintaining the state of the test execution. It encapsulates the test session builder, test component, instrumentation log, and progress reporter.
public class TestContext
- Inheritance
-
TestContext
- Inherited Members
- Extension Methods
Constructors
TestContext(ITestSessionBuilder, IInstrumentation, IProgress<TestStep>?)
Initializes new instance of the TestContext class.
public TestContext(ITestSessionBuilder sessionBuilder, IInstrumentation instrumentation, IProgress<TestStep>? progress = null)
Parameters
sessionBuilder
ITestSessionBuilderThe session builder used to create test sessions.
instrumentation
IInstrumentationThe instrumentation timer associated with the current context to record test execution details.
progress
IProgress<TestStep>Optional progress reporter for tracking test execution progress.
Properties
CurrentComponent
Gets the test component associated with the current context that executes an action or validate test operation.
public ITestComponent? CurrentComponent { get; }
Property Value
Instrumentation
Gets the instrumentation timer associated with the current context to record test execution details.
public IInstrumentation Instrumentation { get; }
Property Value
Progress
Gets an optional object that can be used to report progress updates for the current operation.
public IProgress<TestStep>? Progress { get; }
Property Value
SessionBuilder
Gets an instance of the ITestSessionBuilder
interface that is used to build test sessions.
public ITestSessionBuilder SessionBuilder { get; }
Property Value
Methods
UpdateExecutionContext(ITestComponent)
Updates the TestContext with the currently executing TestComponent and resets the instrumentation timer. This method should be called before executing a new TestComponent to ensure accurate timing and state tracking.
public void UpdateExecutionContext(ITestComponent newComponent)
Parameters
newComponent
ITestComponentThe new TestComponent that is about to be executed.