Reactive Scenarios enable you to use C# code to control execution of the Jobs (TestCases) in a Scenario. Some examples of capabilities provided by Reactive Scenarios:

Run a TestCase with a value or set of values (such as 12 volts), then repeat the same test case with another value (such as 10 volts).

Stop the Scenario or a TestCase based on the value of any Signal or on the Pass/Fail status of the Scenario, any TestCase, or any Signal.

Execute TestCase A, then if it passes execute TestCase B, but execute TestCase C if A failed. See example.

If a TestCase fails, repeat it with another set of Calibration values.

For an example of Reactive Scenarios, TestCases, and Signals, see the SilEasyCruiseControl sample project.

The Reactive Code can access the following types of data, which can be used in the Scenario logic:

Pass/Fail status of Scenarios and TestCases

Execution state of TestCases (Completed, IsRunning, or NotRun)

Commanded or Actual values of Signals

User Interface

To open the Reactive Code dialog, select View->Reactive Code from the MxVDev main menu. Click on an open Scenario to select it. (To see Reactive Code for a TestCase, open and select the TestCase.)

To use Reactive Scenario code, select the Enabled checkbox at the bottom of the Reactive Code panel.  

RS-enable-marked

View the Reactive Code in the Reactive Code tab of the Project Explorer.

RS-ProjectExplorer

User Code Panel

Select a tab: Start, TestCase Complete, Tick, or All Code:

Start: This method is executed when the Scenario starts.

TestCase Complete: This method is executed when any TestCase in the Scenario completes.

Tick: This method is executed each time the Scenario is ticked. The tick interval of the Scenario is specified in the Tick Settings in the Constructs pane.

Transition Received: This method is executed when a transition occurs on a response Signal or on an included Stimulus Signal.

Other: Use this tab for static declarations and method definitions. This code is compiled, but executed only if called from user code.

References: Use this tab to add or remove DLL references to your code.

All Code: This tab displays all the generated code associated with the Scenario.

Constructs Panel

Select a tab to select a category:

Constants

Signals

Scenario

Tags

TestCases

TestCase Complete

Tick

To use an construct listed, select it and click Insert to put it into your user code.

Included Signals

To include a Signal, select its box in the Include column:

RS-included

 

Related Topics:

Reactive Code

Debugging Reactive Code

Reactive TestCases

Sample Project—Reactive and Variants