Reactive and Parameterized Tests

In MxSuite, a TestCase is a definition of a particular system’s required behavior. The behavior should manifest itself, and the test pass, if:

The specified pre-conditions (i.e. the initial state of the system) exist, and

The system under test is stimulated in accordance with the stimuli signal patterns in the TestCase

In many cases, a system may exhibit similar (but not identical) behaviors in response to similar initial conditions and/or similar stimuli. One example is when the SUT might have alternate calibrations. Under these circumstances it may be preferable to make a single parameterized (configurable) TestCase so that one test can be used to test more than one of these situations.

In MxSuite we have concepts of: Tag Groups (Groups and Tags), Calibrations, and Reactive Code which allow us to make tests configurable or Reactive.

A simple example might be a Tag Group called EquipmentLevel, with tags Economy and Luxury. With this concept you can make tests that can be used for both the Economy and Luxury configurations. When you invoke MxSuite, you can activate the Luxury tag in the EquipmentLevel group so that all parameterized tests that respond to that Tag Group run in the Luxury configuration. You can assert Tags in Groups on the command line, from COM, or in Project settings. You can also make such assertions programmatically as reactive Scenario and TestCase code executes.

Defining TagGroups

See the Tags tab under Project Settings.

Asserting Tags in Groups

The default Tag Assertions are established in the Project Settings.

These assertions can be overridden from the Command Line or using the COM programming interface.

In addition the assertions can be overridden by reactive code in a Scenario or TestCase.

Once you have the Tag Groups defined, the next step is to make the system ‘reactive’ to those settings. Described below are a few alternate methods of doing this:

Scenario Filtering in Regressions

A query in the Regression Script can be used to select a subset of Scenarios to execute based on a query that uses groups and tags. The capability allows us to control which Scenarios are run and which ones are skipped.

Static Calibration

MxSuite has a Constants Dictionary. The dictionary allows the Constants to have alternate values, for example, MaxRPM for one ECU configuration may be 6500 and in another 7000. Both values can be associated with the MaxRPM constant. You can select the appropriate Constants by asserting Tags.

You can use the constants for Transition Values, Tolerance levels and in Reactive Code in Scenarios and Test Cases. Asserting a Tag in a Group will cause a test to use one of the alternate values for its Constants.

Programmatic Calibration

Both Scenarios and TestCases can be programmed to have arbitrarily complex behavior. The behavior is implemented in the Reactive Code panel using C#. Function entry points are provided to access the currently active Tag Groups. The code can be made to respond to these groups in many different ways:

Run the same TestCase for each Tag in a group, or each active Tag in a Group.

Conditionally load a whole behavior pattern into a Signal.

Choose which TestCases to run, what order to run them, and how many times a test is run.

Use the pass/fail status of a previous test to select which test to run or configuration to use next.

Related Topics:

Reactive Scenarios

Reactive TestCases

Reactive Code

Constants and Calibrations

Sample Project—SILEasyCruiseControl