OpenTAP 9.24
API Reference
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Properties | List of all members
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. More...
 
IEnumerable< ITestStepGetChildSteps (TestStepSearch searchKind)
 Gets children following a specific search patterns. Not recursive. More...
 
 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.
 
abstract 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. /// More...
 
void OfferBreak (bool isTestStepStarting=false)
 Raises the TestPlan.BreakOffered event on the TestPlan object to which this TestStep belongs. More...
 
- Public Member Functions inherited from OpenTap.ValidatingObject
void OnPropertyChanged (string propertyName)
 Triggers the PropertyChanged event. More...
 

Static Public Member Functions

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

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).
More...
 
GetParent< T > ()
 Searches up through the Parent steps and returns the first step of the requested type that it finds.
More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
- 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. More...
 

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 [getset]
 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 [getset]
 Gets or sets boolean indicating whether this step is enabled in the TestPlan
 
bool IsReadOnly [getset]
 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 [getset]
 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 [getset]
 Gets or sets a List of child TestSteps. Any TestSteps in this list will be executed instead of the Run method of this TestStep.
 
virtual ITestStepParent Parent [getset]
 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 [getset]
 Version of this test step.
 
TestPlanRun PlanRun [getset]
 Gets or sets the TestPlanRun.

 
TestStepRun StepRun [getset]
 Gets or sets the TestStepRun.
 
Guid Id = Guid.NewGuid() [getset]
 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
ValidationRuleCollection Rules [get]
 A collection of all the currently defined validation rules. Add new rules here in order to get runtime value validation.
 
- Properties inherited from OpenTap.ITestStep
Verdict Verdict [getset]
 Gets or sets the verdict. Only available during TestStep run. This property value is propagated to the TestStepRun when the step run completes.

 
string Name [getset]
 Name of the step. Should be set by the user if using multiple instances of the same type.
 
bool Enabled [getset]
 Gets or sets boolean value that indicates whether this step is enabled in the TestPlan.

 
TestPlanRun PlanRun [getset]
 Gets or sets the current TestPlanRun.

 
TestStepRun StepRun [getset]
 Gets or sets the currently running and most recently started TestStepRun.
 
bool IsReadOnly [getset]
 Gets or sets boolean value that indicates whether this step is read only in the TestPlan.

 
string TypeName [get]
 Name of this TestStep type.

 
Guid Id [getset]
 Unique ID used for storing references to test steps.

 
- Properties inherited from OpenTap.ITestStepParent
ITestStepParent Parent [getset]
 Parent TestStep for this TestStep. Null if this TestStep is not a child of any other TestSteps. Only guaranteed to be set during TestPlan.Execute().
 
TestStepList ChildTestSteps [get]
 Gets or sets a list of child TestSteps. (Inherited from ITestStepParent)
 
- Properties inherited from OpenTap.IInputOutputRelations
InputOutputRelation[] Inputs [getset]
 Relations to the object ('this').
 
InputOutputRelation[] Outputs [getset]
 Relations from the object('this');
 

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&lt; T &gt;()

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.24 API built Thu Apr 18 2024 11:46:44