Click here to download the project: https://github.com/DanlawMxTeam/Samples/raw/master/ReactiveVariants.rar
•MxSuite 3.40 or later
This sample includes 3 Scenarios:
•ActiveVariant - demonstrates the Active Variant must pass option and uses a Reactive Scenario and tags
•AnyVariant - demonstrates the Any Variant passes option
•ReactiveScenarioTest - demonstrates a Reactive Scenario
Variants are useful when you have Signal Patterns that are similar, but vary in some portion. The Active Variant option is useful when you have a set of input and output patterns where the result depends on the input. The input and output can be controlled by tags. The Any Variant option is useful when you have multiple result patterns that all meet the requirement of your test.
Reactive Scenarios enable you to use branching logic in your test. Reactive Scenarios can also activate and deactivate tags.
This Scenario runs the TestCaseVariant1 TestCase. The In1 and In2 stimulus values are added to produce the Out response value. The Pattern_2 DataBlock on the In1 Signal includes 3 Variants, labeled Medium, Low, and High. The High Variant is active by default until it is changed by by the Reactive Code. To display the Variant dialog, right-click in the DataBlock and select DataBlock->Variants.
TestCaseVariant1 and Pattern_2 DataBlock
The DataBlock is associated with TagGroup1. The Tag names are the same as the Variant Labels. The High tag and its associated Variant are active by default.
The Out Signal has one DataBlock with 3 Variants.
The ActiveVariant Scenario is defined by Reactive Code. See Reactive Code—TestCase Object.
The AnyVariant Scenario runs the AnyVariantTestCase. The In1 and In2 stimulus values are added to produce the Out response value. The Pattern_2 DataBlock on the In1 Signal includes 3 Variants. The default Variant is active. The Variants are not associated with tags.
The Out Signal has one DataBlock with 3 Variants, labeled High, Medium, and Low. The Any Variant option is selected in the DataBlock properties.
To run the AnyVariant Scenario, click the run button (). This Scenario is designed to pass.
AnyVariantTestCase and Out Variants after Running
Because the expected results of the High Variant match the actual results, the entire TestCase and Scenario pass. To display the Variants dialog, right-click in the DataBlock and select DataBlock->Variants.
The Scenario in the Reactive Scenario Test uses this branching logic: If TestCaseA passes, run TestCaseB. If TestCaseA fails, run TestCaseC.
The code in the Start tab runs TestCaseA. When TestCaseA is complete, the code in the TestCase Complete tab checks its PassFailState and runs the next TestCase.