OpenTAP 9.34
API Reference
OpenTap.TestStep Class Referenceabstract

All TestSteps that are instances of the TestStep abstract class should override the TestStep.Run method. Additionally, the TestStep.PrePlanRun and TestStep.PostPlanRun methods can be overridden. More...

Inheritance diagram for OpenTap.TestStep:
OpenTap.ValidatingObject OpenTap.ITestStep OpenTap.IDynamicMembersProvider OpenTap.IInputOutputRelations OpenTap.IParameterizedMembersCache OpenTap.IValidatingObject OpenTap.ITestStepParent OpenTap.IValidatingObject OpenTap.ITapPlugin

Public Member Functions

IEnumerable< ITestStepRecursivelyGetChildSteps (TestStepSearch searchKind)
 Recursively collects a completely list of child steps using the specified pattern. Order is depth-first.
 
IEnumerable< ITestStepGetChildSteps (TestStepSearch searchKind)
 Gets children following a specific search patterns. Not recursive.
 
 TestStep ()
 Initializes a new instance of the TestStep base class.
 
virtual void PrePlanRun ()
 Called by TestPlan.Run() for each step in the test plan prior to calling the TestStep.Run method of each step.
 
void Run ()
 Called by TestPlan.Run() to run each TestStep. If this step has children (ChildTestSteps.Count > 0), then these are executed instead.
 
virtual void PostPlanRun ()
 Called by TestPlan.Run() after completing all TestStep.Run methods in the TestPlan. ///.
 
void OfferBreak (bool isTestStepStarting=false)
 Raises the TestPlan.BreakOffered event on the TestPlan object to which this TestStep belongs.
 
- Public Member Functions inherited from OpenTap.ValidatingObject
void OnPropertyChanged (string propertyName)
 Triggers the PropertyChanged event.
 
- Public Member Functions inherited from OpenTap.IValidatingObject
- Public Member Functions inherited from OpenTap.ITestStep
- Public Member Functions inherited from OpenTap.IParameterizedMembersCache

Static Public Member Functions

static string[] GenerateDefaultNames (ITypeData stepType)
 Returns a default name for a step type.
 
static string[] GenerateDefaultNames (Type stepType)
 Returns a default name for a step type.
 

Protected Member Functions

void UpgradeVerdict (Verdict verdict)
 Sets the Verdict if it is not already set to a more serious verdict (for example, a Pass verdict would be upgraded to Fail, which is more serious).

 
GetParent< T > ()
 Searches up through the Parent steps and returns the first step of the requested type that it finds.

 
IEnumerable< TestStepRunRunChildSteps (IEnumerable< ResultParameter > attachedParameters=null)
 Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.
 
IEnumerable< TestStepRunRunChildSteps (bool throwOnBreak)
 Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.
 
IEnumerable< TestStepRunRunChildSteps (IEnumerable< ResultParameter > attachedParameters, CancellationToken cancellationToken)
 Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.
 
IEnumerable< TestStepRunRunChildSteps (IEnumerable< ResultParameter > attachedParameters, CancellationToken cancellationToken, bool throwOnBreak)
 Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.
 
TestStepRun RunChildStep (ITestStep childStep, IEnumerable< ResultParameter > attachedParameters=null)
 Runs the specified child step if enabled. Upgrades parent verdict to the resulting verdict of the child run. Throws an exception if childStep does not belong or isn't enabled.
 
TestStepRun RunChildStep (ITestStep childStep, bool throwOnBreak, IEnumerable< ResultParameter > attachedParameters=null)
 Runs the specified child step if enabled. Upgrades parent verdict to the resulting verdict of the child run. Throws an exception if childStep does not belong or isn't enabled.
 
- Protected Member Functions inherited from OpenTap.ValidatingObject
virtual string GetError (string propertyName=null)
 Return the error for a given property.
 
void ThrowOnValidationError (bool ignoreDisabledProperties)
 Checks all validation rules on this object (Rules) and throws an AggregateException on errors.
 

Static Protected Attributes

static readonly TraceSource Log = OpenTap.Log.CreateSource("TestStep")
 Log used to Log trace messages from TestSteps. These messages will be written with "TestStep" as the source.
 

Properties

Verdict Verdict [get, set]
 Gets or sets the verdict. Only available during test step run. The value of this property will be propagated to the TestStepRun when the step run completes.
 
bool Enabled [get, set]
 Gets or sets boolean indicating whether this step is enabled in the TestPlan.
 
bool IsReadOnly [get, set]
 Gets or sets boolean indicating whether this step is read-only in the TestPlan. This is mostly a declaration of intent, GUIs should respect it, but few things enforces it.
 
string Name [get, set]
 Gets or sets the name of the TestStep instance. Not allowed to be null. In many cases the name is unique within a test plan, but this should not be assumed, use Idfor an unique identifier. May not be null.
 
string TypeName [get]
 This TestStep type as a string.

 
TestStepList ChildTestSteps [get, set]
 Gets or sets a List of child TestSteps. The teststeps in this list will be executed in the RunChildSteps(System.Collections.Generic.IEnumerable<OpenTap.ResultParameter>) method.
 
virtual ITestStepParent Parent [get, set]
 The parent of this TestStep. Can be another TestStep or the TestPlan.

 
ResultSource Results [get]
 Result proxy that stores TestStep run results until they are propagated to the ResultListener.

 
IEnumerable< ITestStepEnabledChildSteps [get]
 The enumeration of all enabled Child Steps.
 
string Version [get, set]
 Version of this test step.
 
TestPlanRun PlanRun [get, set]
 Gets or sets the TestPlanRun.

 
TestStepRun StepRun [get, set]
 Gets or sets the TestStepRun.
 
Guid Id = Guid.NewGuid() [get, set]
 Gets or sets the ID used to uniquely identify a test step within a test plan.
 
- Properties inherited from OpenTap.ValidatingObject
ValidationRuleCollection Rules [get]
 All the validation rules. Add new rules to this in order to get runtime value validation.
 
string Error [get]
 Gets the error messages for each invalid rule and joins them with a newline.
 
- Properties inherited from OpenTap.IValidatingObject
- Properties inherited from OpenTap.ITestStep
- Properties inherited from OpenTap.ITestStepParent
- Properties inherited from OpenTap.IDynamicMembersProvider
- Properties inherited from OpenTap.IInputOutputRelations

Additional Inherited Members

- Events inherited from OpenTap.ValidatingObject
PropertyChangedEventHandler PropertyChanged
 Standard PropertyChanged event object.
 

Detailed Description

All TestSteps that are instances of the TestStep abstract class should override the TestStep.Run method. Additionally, the TestStep.PrePlanRun and TestStep.PostPlanRun methods can be overridden.

ITestStep can also be inherited from instead.

Member Function Documentation

◆ GenerateDefaultNames() [1/2]

static string[] OpenTap.TestStep.GenerateDefaultNames ( ITypeData stepType)
inlinestatic

Returns a default name for a step type.

Parameters
stepType
Returns

◆ GenerateDefaultNames() [2/2]

static string[] OpenTap.TestStep.GenerateDefaultNames ( Type stepType)
static

Returns a default name for a step type.

Parameters
stepType
Returns

◆ GetChildSteps()

IEnumerable< ITestStep > OpenTap.TestStep.GetChildSteps ( TestStepSearch searchKind)
inline

Gets children following a specific search patterns. Not recursive.

Parameters
searchKindSearch pattern to use.
Returns
Unevaluated IEnumerable.

◆ GetParent< T >()

T OpenTap.TestStep.GetParent< T > ( )
inlineprotected

Searches up through the Parent steps and returns the first step of the requested type that it finds.

Template Parameters
TThe type of TestStep to get.
Returns
The closest TestStep of the requested type in the hierarchy.

◆ OfferBreak()

void OpenTap.TestStep.OfferBreak ( bool isTestStepStarting = false)
inline

Raises the TestPlan.BreakOffered event on the TestPlan object to which this TestStep belongs.

This method allows a user interface implementation to break/pause the execution of the TestPlan at the point at which it is called.

◆ PostPlanRun()

virtual void OpenTap.TestStep.PostPlanRun ( )
inlinevirtual

Called by TestPlan.Run() after completing all TestStep.Run methods in the TestPlan. ///.

Note that TestStep.PostPlanRunrun is run in reverse order. For example, suppose you had three tests: T1, T2, and T3. PrePlanRun would run for T1, T2 and T3 (in that order), and PostPlanRun would run for T3, T2 and T1 (in that order).

Implements OpenTap.ITestStep.

◆ RecursivelyGetChildSteps()

IEnumerable< ITestStep > OpenTap.TestStep.RecursivelyGetChildSteps ( TestStepSearch searchKind)
inline

Recursively collects a completely list of child steps using the specified pattern. Order is depth-first.

Parameters
searchKindPattern.
Returns
Unevaluated IEnumerable of test steps.

◆ RunChildStep() [1/2]

TestStepRun OpenTap.TestStep.RunChildStep ( ITestStep childStep,
bool throwOnBreak,
IEnumerable< ResultParameter > attachedParameters = null )
inlineprotected

Runs the specified child step if enabled. Upgrades parent verdict to the resulting verdict of the child run. Throws an exception if childStep does not belong or isn't enabled.

Parameters
childStepThe child step to run.
throwOnBreak
attachedParametersParameters that will be stored together with the actual parameters of the step.

◆ RunChildStep() [2/2]

TestStepRun OpenTap.TestStep.RunChildStep ( ITestStep childStep,
IEnumerable< ResultParameter > attachedParameters = null )
inlineprotected

Runs the specified child step if enabled. Upgrades parent verdict to the resulting verdict of the child run. Throws an exception if childStep does not belong or isn't enabled.

Parameters
childStepThe child step to run.
attachedParametersParameters that will be stored together with the actual parameters of the step.

◆ RunChildSteps() [1/4]

IEnumerable< TestStepRun > OpenTap.TestStep.RunChildSteps ( bool throwOnBreak)
inlineprotected

Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.

Parameters
throwOnBreakWhether an exception will be thrown due to break conditions or if they will be caught. Exceptions are still available on child test steps TestStepRun.Exception.

◆ RunChildSteps() [2/4]

IEnumerable< TestStepRun > OpenTap.TestStep.RunChildSteps ( IEnumerable< ResultParameter > attachedParameters,
CancellationToken cancellationToken )
inlineprotected

Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.

Parameters
attachedParametersParameters that will be stored together with the actual parameters of the steps.
cancellationTokenProvides a way to cancel the execution of child steps before all steps are executed.

◆ RunChildSteps() [3/4]

IEnumerable< TestStepRun > OpenTap.TestStep.RunChildSteps ( IEnumerable< ResultParameter > attachedParameters,
CancellationToken cancellationToken,
bool throwOnBreak )
inlineprotected

Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.

Parameters
attachedParametersParameters that will be stored together with the actual parameters of the steps.
cancellationTokenProvides a way to cancel the execution of child steps before all steps are executed.
throwOnBreakWhether an exception will be thrown due to break conditions or if they will be caught. Exceptions are still available on child test steps TestStepRun.Exception.

◆ RunChildSteps() [4/4]

IEnumerable< TestStepRun > OpenTap.TestStep.RunChildSteps ( IEnumerable< ResultParameter > attachedParameters = null)
inlineprotected

Runs all enabled TestStep.ChildTestSteps of this TestStep. Upgrades parent verdict to the resulting verdict of the childrens run. Throws an exception if the child step does not belong or isn't enabled.

Parameters
attachedParametersParameters that will be stored together with the actual parameters of the steps.

◆ UpgradeVerdict()

void OpenTap.TestStep.UpgradeVerdict ( Verdict verdict)
inlineprotected

Sets the Verdict if it is not already set to a more serious verdict (for example, a Pass verdict would be upgraded to Fail, which is more serious).

Parameters
verdictNew verdict to set.

OpenTAP 9.34 API built Wed Jul 1 2026 09:21:15