OpenTAP 9.27
API Reference
Public Member Functions | Properties | List of all members
OpenTap.ScalarResultSink< T > Class Template Reference

ResultSink that will provide the first result from a given result column published by a given TestStep. When SourceTestStep is inside a loop step, only results from the last iteration of SourceTestStep is accessible. More...

Inheritance diagram for OpenTap.ScalarResultSink< T >:
OpenTap.IResultSink

Public Member Functions

 ScalarResultSink (ITestStep listeningStep)
 Creates an instance. This should probably be called from the constructor of the TestStep. More...
 
GetResult (CancellationToken ct)
 Called by TestSteps when the result is needed. Blocks until a result is available.
 
bool TryGetResult (out T result)
 Called by TestSteps when the result is needed. Returns true if a result is available.
 
void OnTestStepRunStart (TestStepRun run)
 Resets result collection when a new run of the SourceTestStep is started.
 
void OnTestStepRunCompleted (TestStepRun run)
 Called when a TestStep is completed.
 
void OnResultPublished (TestStepRun stepRun, ResultTable result)
 Called by OpenTAP when the source TestStep publishes results. This is happening in a background thread.
 
void OnTestPlanRunStart (TestPlanRun run)
 Initializes this instance.
 
void OnTestPlanRunCompleted (TestPlanRun run)
 Cleans up after this instance
 

Properties

ITestStep SourceTestStep [getset]
 The ID of the source TestStep that we are interested in results from.
 
string ResultColumnName [getset]
 The name of the result column to get the result from.
 

Detailed Description

ResultSink that will provide the first result from a given result column published by a given TestStep. When SourceTestStep is inside a loop step, only results from the last iteration of SourceTestStep is accessible.

Type Constraints
T :IConvertible 

Constructor & Destructor Documentation

◆ ScalarResultSink()

OpenTap.ScalarResultSink< T >.ScalarResultSink ( ITestStep  listeningStep)
inline

Creates an instance. This should probably be called from the constructor of the TestStep.

public class ListeningStepExample : TestStep
{
public ITestStep SourceStep { get => Sink.SourceTestStep; set => Sink.SourceTestStep = value; }
public ScalarResultSink<double> Sink { get; set; }
public ListeningStepExample()
{
Sink = new ScalarResultSink<double>(this);
}
public override void Run()
{
log.Debug("Result was: {0}", Sink.GetResult(TapThread.Current.AbortToken));
}
}
@ Run
Indicates that a teststep is about to be run.
Parameters
listeningStep

OpenTAP 9.27 API built Wed Nov 27 2024 13:14:46