RSI Logo
Google
Reactis: Model-Based Testing and Validation
 
 Reactis User's Guide   Contents  |  Index
 Chapters:  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20

Chapter 7   Reactis Simulator

Simulator provides an array of features — including single- and multi-step forward and backward execution, breakpoints, simulations driven by Tester-generated test suites, and interactive simulation — for simulating both closed- and open-loop Simulink / Stateflow models. The tool also allows visual tracking of coverage data and the values data items in the model assume during simulation.


Figure 7.1: The Reactis Simulator window.

Figure 7.1 contains an annotated screen shot of a portion of the Simulator window. Some of the buttons and pull-down menus on the leftmost part of the window have been elided; Chapter 4 contains descriptions of these items. The next section describes the labeled items in Figure 7.1, while the section following discusses the pull-down menus in the Simulator window. The subsequent sections discuss the different modes for generating inputs during simulation, ways to track data values, how to monitor model coverage, importing and exporting test suites, and the different model highlighting styles used by Simulator.

7.1  Labeled Window Items

  1. Disable Reactis Simulator.
  2. Enable Reactis Simulator.
  3. Clicking this button resets the simulation; the model is returned to the start state, and coverage information is appropriately reset.
  4. Clicking this button causes the simulation to take n steps back, where n is specified by window item 11. Coverage information is updated appropriately upon completion of the last backward step.
  5. Clicking this button causes the simulation to take one step back. Coverage information is updated appropriately.
  6. Clicking this button interrupts a (non-fast) forward simulation run. The button is disabled during fast simulation and reverse simulation.
  7. Clicking this button causes the simulation to advance by one mini-step. In Simulink, a mini-step evaluates the next block in the evaluation order. In Stateflow, a mini-step evaluates the next transition segment condition or transition action.
  8. Clicking this button causes the simulation step to advance forward by one full step; that is, values are read on the top-level inports, the model’s response is computed and values are written to the top-level outports. If a step has been partially computed using the mini-step button (window item 7), then execution picks up with the current partially computed step and continues until the end of the step, at which point values are written to the top-level outports.
  9. Clicking this button causes n forward simulation steps to be taken, where n is specified by window item 11. The diagram in the main panel (window item 18) is updated during simulation to reflect the currently active Simulink block or Stateflow state / transition. When Coverage -> Show Details is selected, coverage targets will change from red to black as they are covered during the simulation run. If the end of the current test or test suite is reached or you click the stop button (window item 6), then simulation stops at the end of the current simulation step.
  10. Clicking this button causes n simulation steps to be executed, where n is specified by window item 11. The diagram in the main panel (window item 18) is not updated while the simulation is in progress but is updated when simulation halts. If the end of the current test or test suite is reached then simulation halts. Note that the stop button (window item 6) is disabled during fast simulation.
  11. This window item determines how many steps are taken when buttons corresponding to window items 49 , or 10 are clicked. When the Inputs Source dialog (window item 12) is set to a test or test suite, the number of steps may be set to 0 to indicate that the entire test or test suite should be executed.
  12. The Inputs Source dialog determines how the values arriving on inports are computed during simulation. See Section 7.3 for details.
  13. Clicking this button causes a new, empty test suite to be created. The name of the .rst file containing the suite is initially “unnamed.rst” and is displayed in the title bar of the Reactis window.
  14. Clicking this button displays a dialog for selecting a test-suite (.rst file) to be loaded into Simulator. After it is loaded, the test suite’s name is displayed in the title bar, and the tests are listed in the Inputs Source dialog (window item 12).
  15. Clicking this button causes the current test suite to be saved.
  16. View Reactis Simulator help.
  17. The model hierarchy panel (not shown explicitly) supports the structure-based navigation of a model, as described in Section 4.1. Right-clicking on an item in the navigation panel brings up a menu that also allows you to view data items and set breakpoints. Data viewing is covered in more detail in Section 7.4. Breakpoints may be set by right-clicking on a subsystem or Stateflow state in the hierarchy panel and selecting Toggle Breakpoint. The name in the hierarchy panel is then decorated with a “stop sign” icon (    ). When a subsystem breakpoint is set, simulation pauses whenever an item in the subsystem (Simulink block or Stateflow transition) executes. When a Stateflow state breakpoint is set, simulation pauses whenever the state is entered or exited.
  18. The main panel displays the currently selected Simulink or Stateflow diagram. You may interact with the diagram in a number of different ways using the mouse including hovering over model items, double clicking on items, or right clicking in various parts of the panel. The following mouse operations are available:
    Hovering...

    • over a data item (Simulink block or signal line, or Stateflow variable) will display its current value and type.
    • over a Goto block will cause it and its associated From block(s) to be highlighted in green.
    • over a From block will cause it and its associated Goto block to be highlighted in green.
    • over any Tester coverage target will display the test and step within the test during which the target was first executed. This information is presented in a message of the form “Covered: test/step”. A “.” in the test location indicates the current simulation run. For more details on querying coverage information see Section 7.5, Chapter 10, and Chapter 6.
    • over a Validator diagram objective will cause its wiring information to be drawn in blue.
    Double Clicking...

    • on a Simulink block will display the block’s parameters.
    • on a Simulink subsystem will cause the subsystem diagram to be displayed in the main panel.
    • on a Stateflow state will cause the state’s diagram to be displayed in the main panel.
    • on a top-level input port while Simulator is disabled will bring up a type editor window to modify that port’s type. If Simulator is enabled and running in user guided simulation mode then double-clicking on a top-level input port will bring up a panel to modify that inport’s current input value.
    • on a configuration variable in the Configuration Variable Panel (see Section 4.3) while Simulator is disabled will bring up a type editor window to modify that variable’s type. If Simulator is enabled then double-clicking on a configuration variable will bring up a panel to modify the variable’s current value.
    Right Clicking...

    Causes different pop-up menus to be displayed based on where the click occurs. A summary of the menu items follows:
    Add To Watched
    Add item to watched variables list (see section 7.4.1). Available when right-clicking on Simulink signals, Simulink blocks, Stateflow variables.
    Open Scope
    Display item in scope (see section 7.4.2). Available when right-clicking on Simulink signals, Simulink blocks, Stateflow variables.
    Open Distribution Scope
    Display item in distribution scope (see section 7.4.3). Available when right-clicking on Simulink signals, Simulink blocks, Stateflow variables.
    Add To Scope
    Add item to previously opened scope. Available when right-clicking on Simulink signals, Simulink blocks, Stateflow variables.
    Add Assertion
    Create new Assertion (see section 9.2). Available when right-clicking on whitespace in Stateflow state or Simulink subsystem.
    Add User Defined Target
    Create new user defined target (see section 9.2). Available when right-clicking on whitespace in Stateflow state or Simulink subsystem.
    Cut, Copy, Paste
    Cut, copy or paste assertions or user defined targets to/from the clipboard. Available when right-clicking on user defined target or assertion.
    Remove
    Remove a user defined target or assertion (see section 9.2). Available when right-clicking on user defined target or assertion.
    Edit/View Properties
    Edit or view user defined target properties. “Edit” is available when Simulator is disabled, “View” otherwise (see section 9.2). Available when right-clicking on user defined target or assertion.
    View Coverage Details
    Display dialog containing more detailed coverage information. (see sections 6.1.3, 6.3.1, 6.3.2 and 7.5.2) Available when right-clicking on Simulink “Logic”, “Lookup Table” or top-level “Inport” blocks and Stateflowtransitions.
    View Block Parameters
    Display Simulink block parameters. Available when right-clicking on Simulink blocks.
    Edit Type
    Modify type of top-level input ports or configuration variable (see Section 5.4). Available when right-clicking on top-level input port or configuration variable in Configuration Variable Panel (see Section 4.3).
    Change Value
    Modify current value of top-level input ports (see section 7.3.1) or configuration variables. Available when right-clicking on top-level input port or configuration variable (in “Configuration Variables” system.
    Toggle Breakpoint
    Enable or disable breakpoint for an item. Available when right-clicking on non-virtual Simulink block or Stateflow transition.
    Extract Subsystem
    Extract a subsystem and save it in a separate model file (see section 4.4). Available when right-clicking on Simulink subsystem.

7.2  Menus

Except for the documented exceptions related to editing .rsi files 1, the menus described in Section 4.2 work in the same manner when Simulator is enabled. The following additional menu items are also active when Simulator is enabled.

View menu.
The following entries become enabled when Simulator is “on”.
Select Line Styles...
Invokes a dialog to configure how model elements are rendered by Simulator. See Section 7.7 for details.
Show Watched Variables.
Toggle whether or not watched-variable list is displayed. The default is not to show them; adding to the list automatically causes the list to be displayed.
Add Watched Variables.
Add data items (Simulink blocks or signal lines, or Stateflow variables) to watched-variable list. Selecting this entry brings up a list of data items. You can toggle whether or not an entry in the list is selected by control-left-clicking on it; clicking OK causes the selected items to be added to the watch list.
Clear Watched Variables.
Remove all items from the watch list.
Open Scopes...
Open scopes for data items (Simulink blocks or signal lines, or Stateflow variables). Selecting this entry brings up a list of items. You can toggle whether or not an entry in the list is selected by control-left-clicking on the variable; clicking OK causes scopes to be opened for each selected item.
Open Distribution Scopes...
Open distribution scopes for data items (Simulink blocks or signal lines, or Stateflow variables). Selecting this entry brings up a list of items. You can toggle whether or not an entry in the list is selected by control-left-clicking on the variable; clicking OK causes distribution scopes to be opened for each selected item.
Close All Scopes.
Closes all open scopes.
Save Profile as...
Save the current view profile under a new name. The view profile contains the currently opened scopes and watched variables. Profiles are saved in with the .rsp suffix.
Load Profile...
Load a different view profile (.rsp file ). This will automatically open all scopes and watched variables stored in the profile.
Simulate menu.
The following entries are available when Simulator is enabled.
Simulator on/off.
Enable or disable Simulator. When disabled Simulator behaves as a model viewer; that is, the model can be viewed but simulation capabilities are disabled.
Fast Run.
Same as window item 10.
Run.
Same as window item 9.
Step.
Same as window item 8.
Mini-Step.
Same as window item 7.
Stop.
Same as window item 6. Note that this entry is enabled only when the simulator is in the midst of a “regular” (i.e. non-fast) run.
Back.
Same as window item 5.
Fast Back.
Same as window item 4.
Reset.
Same as window item 3.
Toggle Breakpoint.
Sets a breakpoint for the currently selected item in the model-hierarchy panel if none exists, or clears the breakpoint if one has already been set. Simulation will halt when the item becomes active, which may be in the middle of a simulation step. The simulator controls may then be used to continue execution of the model.
Clear Breakpoints.
Removes all breakpoints.
Set Animation Delay...
When running a slow simulation, this value specifies the duration of the pause between the evaluation and highlighting of different model elements.
Update Configuration Variable...
Initiates a dialog for changing values of configuration variables, which are workspace variables whose values can only change between tests/simulation runs (but not during a test/simulation run). The simulation must be reset to the start state (by clicking the reset button    , window item 3) before the value of a configuration variable may be updated. Note also that whenever inputs are read from a test, the configuration variable values from the test will be used. In other words manual updates to a configuration variable using this menu item will only have effect when in random or user input mode.
Test Suite menu.
New.
Same as window item 13.
Open.
Same as window item 14.
Save.
Same as window item 15.
Save and Defragment.
Removing tests from a test suite can cause the test suite to become fragmented, meaning that space within the file becomes unused. Reactis will reuse those gaps when you add tests. Selecting this menu item will save the current test suite and reorganize it, removing all gaps.
Save As...
Save current test suite in an .rst file . A file-selection dialog is opened to determine into which file the test suite should be saved.
Import...
Import tests and add them to the current test suite. Importing is described in more detail in Section 7.6.3.
Export...
Export the current .rst file in different formats. Exporting is described in more detail in Section 7.6.2.
Create...
Launch Reactis Tester. See Chapter 8 for details.
Browse...
Open a file selection dialog, and then launch the Test-Suite Browser on the selected file. See Chapter 11 for details.
Browse current...
Launch the Test-Suite Browser on the currently loaded test suite. See Chapter 11 for details.
Add/Extend Test.
At any point during a simulation, the current execution sequence (from the start state to the current state) may be added as a test to the current test suite by selecting this menu item. After the test is added it will appear in the Inputs Source dialog (window item 12). Note that the new test will not be written to an .rst file until the current test suite has been saved using window item 15 or the Test Suite -> Save menu item.
Remove Test.
Remove the current test from the current test suite. Note that the test will not be removed from the .rst file until the current test suite has been saved using window item 15 or the Test Suite -> Save menu item.
Compare Outputs.
Specify whether or not Simulator should compare the simulation outputs against the outputs contained in the test suite being executed. Simulation stops when the first discrepancy is detected, and the difference between the computed value and the value stored in test suite is reported.
Update Outputs.
Create a new test suite by simulating the current model using inputs from the current test suite, but recording outputs generated by the model. This feature is useful for updating test suites when a model is modified, but its input ports remain unchanged. The result of invoking this routine is a new test suite with the same inputs at each step, but with outputs that are generated by the currently loaded version of the model.
Validate menu.
See Chapter 9 for a description of this menu.
Coverage menu.
The Coverage menu contains the following entries. Details about the different coverage objectives may be found in Chapter 6. The coverage information available from the various menu items is for the current simulation run. If a test suite is being executed the coverage data is cumulative. That is all targets covered by the portion of the current test executed so far, plus those targets exercised in previous tests are listed as covered.
Show Summary.
Open the coverage summary dialog shown in Figure 7.6.
Show Details.
Report coverage information by coloring diagram elements as defined in the Line Style dialog shown in Figure 7.9.
Show Report.
Start the Coverage-Report Browser. See Chapter 10 for details.
Subsystems,
Branches, User Targets, Assertions, States, Condition Actions, Transition Actions, Conditions, Decisions, MC/DC.
Each of these menu entries corresponds to one of the model coverage criteria tracked by Reactis and described in Chapter 6. When a menu entry is selected and Show Details is selected, any uncovered target in the corresponding coverage criterion will be colored.
Select All.
When Show Details is selected, show coverage information for all criteria.
Deselect All.
When Show Details is selected, show no coverage information.
Unreachable Targets.
When Show Details is selected, color unreachable targets. A target is unreachable if it can be determined to be unexecutable without running the model. The analysis used is conservative: marked items are always unreachable, but some unmarked items may also be unreachable.

7.3  Specifying the Simulation Input Mode


Figure 7.2: The inputs source dialog enables you to specify how Simulator computes input values.

Reactis Simulator performs simulations in a step-by-step manner: at each simulation step inputs are generated for each inport, and resultant outputs reported on each outport. In the case of open models (those with top-level inports), you can control how Simulator computes input values using the Inputs Source dialog (window item 12 in Figure 7.1) shown in Figure 7.2. This dialog always includes the Random Simulation and User Guided Simulation entries; if a test suite has been loaded, then the dialog includes an entry for each test and the All button becomes enabled. The dialog is used to specify how input values are generated as follows.

Random Simulation.
For each inport, Reactis randomly selects a value from the set of allowed values for the inport, using type and probability information contained in the associated .rsi file . See Chapter 5 for a description of how to enter this information using the Reactis Info File Editor.
User Guided Simulation.
You determine the value for each inport using the “Next Input Values” dialog, which appears when the “User Guided Simulation” entry is selected. See Section 7.3.1 below for more information on this mode.
Individual Tests.
When a test suite is loaded, each test in the suite has a row in the dialog that contains a test number, a sequence number, a name and the number of steps in the test. Selecting a test and clicking okay will cause inputs to be read from the test.
Subset of Tests.
You may specify that a subset of tests should be run by holding down the control key and clicking on each test to be run with the left mouse button. The tests will be run in the order they are selected. As tests are selected the sequence number column is updated to indicate the execution order of the tests. When a new test is started, the model is reset to its starting configuration, although coverage information is not reset, thereby allowing users to view cumulative coverage information for the subset of tests.
All Tests.
Clicking the all button in the lower left corner specifies that all tests in the suite should be executed one after another. The tests are executed sequentially. When a new test is started, the model is reset to its starting configuration, although coverage information is not reset, thereby allowing you to view cumulative coverage information for the entire test suite. Section 7.3.2 contains more information on this mode.

You can change the sorting order of the tests in the table by clicking on the column headers. For example, to sort the tests by the number of steps, simply click on the header of the “Steps” column. Clicking again on that header will sort by number of steps in descending order.

You may also use the Inputs Source dialog to change the name of a test. To do so, select the test by clicking on it, then click on the name and, when the cursor appears, type in a new name.

7.3.1  User Input Mode

When the “User Guided Simulation” mode is selected from the Inputs Source dialog, users must provide values for inports at each execution step. This section describes how this is done.


Figure 7.3: The Next Input Values dialog.

To enter the user-guided mode of operation, select “User Guided Simulation” from the Inputs Source dialog (window item 12). Upon selecting user-guided mode, a Next Input Values dialog appears, as shown in Figure 7.3, that allows one to specify the input values for the next simulation step. Each top-level inport of the model has a row in the dialog; each row contains the following entries (see numbering in Figure 7.3).

  1. The inport name.
  2. This pull-down menu has three entries that determine how the next value for the port is specified:
    Random.
    Randomly select the next value for the inport from the type given for the inport in the .rsi file.
    Entry.
    Specify the next value with the text-entry box in column three.
    Panel.
    Open a sub-panel to specify the next value. This input mode is primarily used when the port reads vector values.
  3. If the pull-down menu in column two is set to “Entry”, then the next input value is taken from this text-entry box.
  4. If the pull-down menu in column two is set to “Entry”, then clicking this history button displays recent values the inport has assumed. Selecting a value from the list causes it to be placed in the text-entry box of column three.
  5. The arrow buttons in this column enable scrolling through the possible values for the port. The arrows are not available for ports having a type or base type of double, single, sfix*, or ufix*.
  6. This pull-down menu sets the input type for all ports at once to either “Random” or “Entry.”

When “run” or “fast run” (window item 9 or 10 in Figure 7.1) is selected, the inport value specifications in the Next Inputs Values dialog are used for each step in the simulation run.

7.3.2  Test Input Mode

Simulation inputs may also be drawn from tests in a Reactis test suite. Such tests may be generated automatically by Reactis Tester, constructed manually in Reactis Simulator, or imported using a comma separated value file format. By convention files storing Reactis test suites have names suffixed by .rst.

A Reactis test suite may be loaded into Simulator by clicking the    in the tool bar to the right of Inputs Source dialog (window item 14 in Figure 7.1) or by selecting the Test Suite -> Open menu item.

When a test suite is loaded, the name of the test suite appears in the Reactis title bar and the tests of the suite are listed in the Inputs Source dialog.

7.4  Tracking Data-Item Values

Reactis Simulator includes several facilities for interactively displaying the values that data items (Simulink blocks or signal lines, or Stateflow variables) assume during simulation. The watched-variable list, or “watch list” for short, displays the current values of data items designated by the user as “watched variables.” You may also attach scopes to data items in order to display values as they vary over time. Scopes behave like Simulink Scope blocks except that they are not hard-wired into models and are instead opened and closed during simulation. Distribution scopes enable you to view the set of values a data item has assumed during simulation (but not the time at which they occur).

You may add data items to the watch list, or attach scopes to them, as follows.

Using the View menu.
The View menu contains operations for adding data items to the watch list, opening scopes, and opening distribution scopes. These are described in more detail in Section 7.2.
Using pop-up menus in the model hierarchy panel.
Right-clicking on a subsystem in the hierarchy panel brings up a pop-up menu that includes the entries:
  • Add Watched Variables,
  • Open Scopes,
  • Open Distribution Scopes.
Selecting one of these entries will cause a dialog to appear listing data items in the subsystem which may be added to the watched variable list or to which scopes may be attached.
Using pop-up menus in the main panel.
Right-clicking on a data item in the main panel of Simulator invokes a menu that enables you to add the data item to the list of watched variables or open a scope or distribution scope to monitor the values of the data item during simulation. This menu also includes an entry Add To Scope that enables you to plot the data item on a previously opened scope.

One may save the current configuration of the data tracking facilities (the variables in the watch list and currently open scopes along with their locations) for use in a future Simulator session. One does so, by selecting View -> Save Profile As... and using the resulting file selection dialog to specify a file in which to save a Reactis profile (.rsp file ). The profile may be loaded at a future time by selecting View -> Load Profile....

7.4.1  The Watched-Variable List

The watch list is displayed in a panel at the bottom of the Simulator screen as shown in Figure 3.7. By default this panel is hidden, although adding a variable to the watch list causes the panel to become visible. Visibility of the panel may also be toggled using the View menu as described in Section 7.2. The panel displays a list of data items and their values. The values are updated after each simulation step.

The contents of the watch list may be edited using a pop-up menu that is activated from inside the watch-list panel. Individual data items in the panel may be selected by left-clicking on them. Once an item is selected, right-clicking invokes a pop-up menu that enables the selected item(s) to be deleted, have a scope opened, or have a distribution scope opened. If no item is selected, then these choices are grayed out. The right-click pop-up menu also includes an entry Add Variables which displays a list of all data items in the model which may be added to the watch list.

The View menu contains operations for displaying / hiding the watch list, adding data items to the watch list, clearing the watch list.

7.4.2  Scopes

Scopes appear in separate windows, an example of which may be found in Figure 7.4. The tool bar of each scope window contains five or more items. The first two, window items 1 and 2, are toggle buttons for controlling the scaling of the coordinate system used to display values, and third (window item 3) is a “zoom to fit” button. If both toggles are “on” (the default), then left-clicking in the scope window causes the view to become zoomed-in and re-centered; right-clicking causes the scale to become zoomed-out and re-centered. Turning off either of the buttons 1 or 2 disables scaling for the indicated axis: X or Y respectively.


Figure 7.4: A scope window plotting desired speed (yellow) and actual speed (green).

The fourth and fifth tool bar items are toggle buttons to indicate whether data items should be plotted as solid lines (window item 4) or as points (window item 5).

If more than one data item is plotted on a scope, then a toggle button will appear in the tool bar for each data item. Turning one of these buttons off will hide the corresponding data item in the scope. Hovering over the button will display the data item to which the button corresponds.

7.4.3  Distribution Scopes

Distribution scopes also appear in separate windows, an example of which may be found in Figure 7.5. The values a data item assumes are displayed as data points distributed across the X-axis. Left-clicking in the distribution scope causes the view to be zoomed-in and re-centered; right-clicking causes the scale to become zoomed-out and re-centered. Clicking the “zoom to fit” button re-scales the view so that the minimum value appears at the left edge of the plot and the maximum value appears at the right edge.


Figure 7.5: Distribution scopes plot the values a data item has assumed during simulation.

7.5  Tracking Model Coverage

Chapter 6 describes the coverage criteria that Reactis employs for measuring how many of a given class of syntactic constructs or coverage targets that appear in a model have been executed at least once. Simulator includes extensive support for viewing this coverage information about the parts of the model that have been exercised by the current simulation run. If a test suite is being executed the coverage data is cumulative. That is all targets covered by the portion of the current test executed so far, plus those targets exercised in previous tests are listed as covered.

7.5.1  The Coverage Summary Dialog

The Coverage Summary Dialog shown in Figure 7.6 may be invoked at any time Simulator is enabled by selecting Coverage -> Show Summary. The dialog reports summary statistics for each coverage criterion tracked by Reactis. Each row in the dialog corresponds to one of the criterion and includes five columns described below from left to right.

  1. The name of the coverage criterion reported in the row.
  2. The number of targets in the criterion that have been exercised at least once.
  3. The number of targets in the criterion that are unreachable. A conservative analysis is performed to check for unreachable targets. Any target listed as unreachable is provably unreachable; however, some unreachable targets might not be flagged as unreachable.
  4. The number of targets in the criterion that have not been exercised.
  5. The percentage of reachable targets in the criterion that have been exercised at least once.

Figure 7.6: The Coverage Summary Dialog

7.5.2  Coverage Information in the Main Panel

Selecting Coverage -> Show Details causes unexercised targets to be drawn in red in the main panel. Targets that have been covered are drawn in black. Hovering over an exercised target will cause a pop-up to be displayed that gives the test and step in which the target was first executed. This type of test and step coverage information is displayed with a message of the form test/step. A “.” appearing in the test position ./step denotes the current simulation run which has not yet been added to a test suite.


Figure 7.7: The dialog for viewing MC/DC related coverage information.

For items included in the MC/DC  coverage measure (Simulink logic blocks and Stateflow transition segments whose label includes an event and/or condition), detailed coverage information may be obtained by right-clicking on the item and selecting View Coverage Details. A dialog similar to that in Figure 7.7 will appear and give coverage information for decision coverage, condition coverage, and MC/DC.

The table in this figure describes coverage for the decision set == 1 && deactivate == 0, which itself contains the two conditions set == 1 and deactivate == 0. Conditions are the atomic boolean expressions that are used in decisions. The first two columns of the table list the test/step information for when the decision first evaluated to true and when it first evaluated to false. A value -/- indicates that a target has not yet been exercised. The third column lists the conditions that make up the decision, while the forth and fifth columns give test/step information for when each condition was evaluated to true and the false.

MC/DC Coverage requires that each condition independently affect the outcome of the decision in which it resides. When a condition has met the MC/DC criterion in a set of tests, the sixth and seventh columns of the table explain how. Each element of these two columns has the form bb:test/step, where each b reports the outcome of evaluating one of the conditions in the decision during the test and step specified. Each b is either T to indicate the condition evaluated to true, F to indicate the condition evaluated to false, or x to mean the condition was not evaluated due to short circuiting.

7.5.3  The Coverage Report Browser

The Coverage-Report Browser enables you to view detailed coverage information and export the reports in HTML format. It is invoked by selecting Coverage -> Show Report and is described in detail in Chapter 10.

7.6  Exporting and Importing Test Suites


Figure 7.8: The Reactis test-suite export window.

7.6.1  The New Test Suite File Format

The V2006 Reactis release introduces a new file format for test suites (.rst files ). The new format allows Reactis to access a test suite directly on disk instead of requiring the entire suite to be loaded in memory. The format enables Reactis to manipulate dramatically larger test suites. The new capability is especially useful when importing huge test suites created outside of Reactis. The new format also enables several other new features including the following:

  • Tests may now have user-specified names.
  • Detailed logs for each test and the suite as a whole are maintained by Reactis.

The new test suite format is enabled by default. It may be disabled by deselecting the “Use new test suite file format” option in the Reactis Settings dialog. Note that the capability to disable the new test suite format will be phased out in future releases, so switching back to the old format should only be used as a temporary solution.

When loading a test suite stored in the pre-V2006 format, the test suite will be automatically converted to the new format. Test suites can be exported to the pre-V2006 format by selecting Test Suite -> Export in Reactis Simulator, and specifying “Reactis V2005.0 and earlier” in the Save as menu of the file selection dialog.

7.6.2  Export

The export feature of Reactis allows you to save .rst files in different formats so that they may be processed easily by other tools. The feature is launched from the Test Suite menu in Simulator. The following formats are currently supported.

.mat files:

Suites may be saved as .mat files so that they may be run using The MathWorks’ Simulink / Stateflow environment. This binary format enables values in tests to be represented with more precision than is possible in the ASCII-based .m file format. When running a Reactis-generated test suite on a Simulink model, the higher precision of test data helps avoid some rounding errors. Section 12.2 describes how to execute exported .mat files in Simulink.

.m files:
Suites may be saved as MATLAB scripts so that they may be run using The MathWorks’ Simulink / Stateflow environment. Section 12.2 describes how to execute exported .m files in Simulink.
.mat files (for FromWorkspace blocks):

Suites may be saved in an alternative .mat file format so that they may be run using The MathWorks’ Simulink / Stateflow environment on a modified version of the model that uses ’FromWorkspace’ blocks in place of top-level inports. Section 12.2 describes the contents of these exported files and how to execute them in Simulink.

.txt files:
Suites may be saved as easy-to-process plain ASCII files. The format of these files is described in Section 12.3.
.csv files:
Suites may be saved as comma separated value (CSV) files. The first line will contain a comma separated list of all the names of the model’s input and output ports, configuration variables, and the simulation time label ___t___. Any names containing non-alphanumeric characters will be surrounded by double quotes (") and newlines in names will be translated to \n. Configuration variables are prefixed by |. Subsequent lines contain either:
  • A comma-separated list of values that includes one value for each item appearing in the first row. The order of the values in a row corresponds to the order the items appeared in the first line. Each such line contains the values for one simulation step. If a port carries a vector signal, then the values of the vector appear within double quotes (") as a comma-separated list.
  • An empty line signaling the end of a test.
Reactis V2005.0 and earlier:
Suites may be saved in the old .rst file format used prior to V2006.

Figure 7.8 contains a screen shot of the export window. One uses the pull-down menu to select the format in which to export a suite.

7.6.3  Import

Reactis can also import tests and add them to the current test suite. The tests must be stored in the comma separated value (CSV) format (described above) that Reactis exports. The import feature is launched from the Test Suite menu in Simulator.

When loading a test suite stored in the pre-V2006 format, the test suite will be automatically converted to the new format.

7.7  Model Highlighting

Simulator renders model diagrams using a number of different colors and line styles to convey information to you during simulation. In this section, we describe these different drawing styles and their semantics.

Some of the default drawing colors are as follows. During slow, single-step, or mini-step simulation, a model element is drawn in green while it is being evaluated. Selecting Coverage -> Show Details configures Reactis to highlight unexercised model elements in red and unreachable model elements in purple. Please refer to Chapter 6 for a description of the different coverage criteria tracked by Reactis.


Figure 7.9: The Select Line Style dialog.

The dialog shown in Figure 7.9 (invoked by selecting View -> Select Line Styles...) enables you to configure how Simulator should draw various diagram elements. Each row in the dialog specifies the rendering of one group of model elements. The different groups of configurable diagram elements are:

Uncovered Block.
A Simulink block B is in this group if it has not been fully exercised, i.e. one of the following holds:
  • B is a block included in the branch coverage criterion and at least one of B’s branches remains uncovered.
  • B is a conditional subsystem that has never been exercised.
  • B is a logical operator block that has not satisfied the requirements for all MC/DC-related coverage criteria (decision, condition, and MC/DC).
Uncovered State.
A Stateflow state is in this group if it has never been entered.
Uncovered Condition Action.
A Stateflow transition segment is in this group if it has not met the requirements for condition action coverage. In other words, its condition action has never been evaluated. If a segment has no condition action, then it is considered uncovered according to condition action coverage if its condition has never evaluated to true. Note that a segment with an empty condition is assumed to evaluate to true whenever the segment is evaluated during simulation.
Uncovered Transition Target.
A Stateflow transition segment is in this group if it has met the requirements for condition action coverage, but has not met the requirements for one of the other coverage criteria associated with transition segments. These criteria include transition action coverage, decision coverage, condition coverage 2, and MC/DC.
Unreachable Block.
A Simulink block B is in this group if Reactis has determined that some aspect of the block’s behavior can never happen and that all behaviors that are possible have occurred 3; i.e. one of the following holds:
  • B is a block included in the branch coverage criterion and at least one of B’s branches is unreachable, while all reachable branches have been exercised.
  • B is a conditional subsystem that can never execute.
  • B is a logical operator block that has one or more MC/DC-related targets that can never be satisfied, and all satisfiable targets have been exercised.
Unreachable State.
A Stateflow state is in this group if it can never be entered.
Unreachable Condition Action.
A Stateflow transition segment is in this group if it can never meet the condition action coverage requirement.
Unreachable Transition Target.
A Stateflow transition segment is in this group if it has met the requirements for condition action coverage, but cannot meet the requirements for one of the other coverage criteria associated with transition segments.
Active Block.
A Simulink block is in this group if it is currently being evaluated.
Active State.
A Stateflow state is in this group if it is currently active.
Active Condition Action.
A Stateflow transition segment is in this group after its condition evaluates to true and until the next model element is highlighted as active.
Active Transition Action.
A Stateflow transition segment is in this group as it is firing as a part of a transition.

1
Any operation which modifies the .rsi file is disabled when Simulator is enabled.
2
Note that “condition coverage” and “condition action coverage” are two distinct criteria.
3
If some reachable behavior has not occurred, then the block is considered a member of the “Uncovered Block” group and rendered accordingly