The objects in the Reactive Code API are for use with Reactive Scenarios and TestCases.
Reactive Code is supported in releases 3.40 and higher.
Example:
Scenario.Stop();
The Scenario tab of the Reactive Code dialog also includes an Insert Breakpoint construct that can be used for debugging reactive code.

|
|
The TestCase object is used in the Reactive TestCase API. Example:
status = TestCasePassFailState;
|
|
Example:
Veh_Speed_RPM.Start(5);
Example: Branching
This example shows branching in a Scenario based on the results of a TestCase. This code is from the TestCase Complete tab of a Reactive Scenario. See Reactive Variants sample.
if(TestCaseA.PassFailState == TestCasePassFailState.Passed) {
TestCaseB.Start(1, "Passed");
Scenario.Stop(); }
if(TestCaseA.PassFailState == TestCasePassFailState.Failed) {
TestCaseC.Start(1, "Failed");
Scenario.Stop(); }
else {
TestCaseB.Start(1, "Unknown");
Scenario.Stop(); }
|
Used for both continuous and discrete numeric Signals.
Example:
if(UserPedalPercent.Value <0) UserPedalPercent.Value = 0;
|
* Setting the value is only available to stimulus Signals.
** Setting the expected value is only available for Signals not in the TestCase or in the TestCase and reactive.
|
Example:
MessageSignal.Value = new byte[] {1,2,3,4};
|
* Setting the value is only available to stimulus Signals not in the TestCase or in the TestCase and reactive.
** Setting the expected value is only available for response Signals not in the TestCase or in the TestCase and reactive.
|
Example:
emf = VOLTAGE.Value;
|
Example:
Tags.MyGroup.MyTag.Activate();
Tags refers to the object within the scope of its calling. A Scenario inherits its tags from the project, and there is no carry over once the Scenario is closed. A TestCase inherits its tags from the Scenario, and there is no carry over once the TestCase is finished.
Iterating through groups (deactivate all active tags):
foreach(TagGroupHandler group in Tags.Groups)
{
foreach(TagHandler tag in group.ActiveTags)
{
If(tag.IsActive)
{
tag.Deactivate();
}
}
}
Access a specific tag:
Tags.MyGroup.MyTag.Activate();
Iterate through tags (Get reference of a group’s active tag and deactivate it):
TagGroupTagHandler tagHandler = null;
foreach( TagGroupTagHandler tag in Tags.MyGroup.Tags)
{
If(tag.IsActive)
{
tagHandler = tag;
}
}
If( tagHandler != null )
{
tagHandler.Deactivate();
}
|
|
Related Topics:
Debugging Reactive Code
Reactive Scenarios
Reactive TestCases
Sample Project—Reactive and Variants (Reactive Scenarios)
Sample Project—SIL Easy Cruise Control (Reactive TestCases)
Tags and Tag Groups