Specifying Model Coverage Reporting Options

Coverage Settings Dialog Box

A large part of using model coverage is specifying model coverage reporting options in the Coverage Settings dialog box. You open this dialog from the Tools menu of a Simulink® window by selecting Coverage Settings. The Coverage Settings dialog box appears with its Coverage pane in focus, as shown.

The sections that follow describe the settings for each tab of the Coverage Settings dialog box.

Coverage Tab

You select the model coverages calculated during simulation in the Coverage pane of the Coverage Settings dialog box.

Coverage for this model

Causes the Simulink® Verification and Validation™ software to gather and report the specified model coverages during simulation. When you select the Coverage for this model option, the Select Subsystem button and the Coverage metrics section of the Coverage pane are enabled, as shown.

Select Subsystem

Specifies the subsystem for which the Simulink Verification and Validation software gathers and reports coverage data. When you enable the Coverage for this model option, the software by default generates coverage data for the entire model.

To restrict coverage reporting to a particular subsystem:

  1. In the Coverage pane of the Coverage Settings dialog box, click Select Subsystem.

    The System Selector dialog box appears.

  2. Select the subsystem for which you want to enable coverage reporting and click OK to close the dialog box.

Coverage for referenced models

Causes the Simulink Verification and Validation software to gather and report the specified model coverages for referenced models during simulation. When you select the Coverage for referenced models option, the Select Models button and the Coverage metrics section of the Coverage pane are enabled, as shown.

Select Models

Specifies the referenced models for which the Simulink Verification and Validation software gathers and reports coverage data. When you enable the Coverage for referenced models option, the software by default generates coverage data for all referenced models.

To enable coverage reporting for particular referenced models:

  1. In the Coverage pane of the Coverage Settings dialog box, click Select Models.

    The Select Models for Coverage Analysis dialog box appears.

  2. Select the referenced models for which you want to enable coverage reporting and click OK to close the dialog box.

Coverage metrics

Select the types of test case coverage analysis that you want the tool to perform (see Types of Model Coverage). The Simulink Verification and Validation software gathers and reports the selected types of coverage for the subsystem, model, and referenced models that you specified elsewhere on the Coverage pane.

Results Tab

You select the destination of model coverage results from model coverage in the Results pane of the Coverage Settings dialog box.

Save Cumulative Results in Workspace Variable

Causes model coverage to accumulate and save the results of successive simulations in the workspace variable specified in the cvdata object name field below. The coverage running total in the workspace variable is updated with new results at the end of each simulation.

Save Last Run in Workspace Variable

Causes model coverage to save the results of the last simulation run in the workspace variable specified in the cvdata object name field below.

Increment Variable Name with Each Simulation

Causes the Simulink Verification and Validation software to increment the name of the coverage data object variable used to save the last run with each simulation. This prevents the current simulation run from overwriting the results of the previous run.

Update Results on Pause

When you pause during simulation the first time, causes the HTML model coverage report to appear with model coverage results recorded up to the pause point. When you resume simulation and later pause or stop simulation, the model coverage report reappears in updated form with coverage results up to the current pause or stop time.

Display Coverage Results Using Model Coloring

After simulation, causes coloring of Simulink blocks according to their level of model coverage. Blocks highlighted in light green received full coverage during testing. Blocks highlighted in light red received incomplete coverage. In addition, model coverage results for each block receiving it is available in context-sensitive form. See Colored Simulink® Diagram Coverage Display for a complete description.

Report Tab

You select the model coverage test sessions (runs) reported by model coverage in the Report pane of the Coverage Settings dialog box.

Generate HTML Report

Causes the Simulink Verification and Validation software to create an HTML report containing the coverage data. The software displays the report in the MATLAB® Help browser at the end of the simulation. Click the Settings button to select various reporting options (see Settings).

Settings

The HTML Settings dialog box allows you to choose various model coverage report options. To display the dialog box, click Settings on the Report pane of the Coverage Settings dialog box. The HTML Settings dialog box appears.

Include each test in the model summary.   When this option is selected, the model hierarchy table at the top of the HTML report includes columns listing the coverage metrics for each test. When this option is not selected, the model summary reports only the total coverage.

Produce bar graphs in the model summary.   Causes the model summary to include a bar graph for each coverage result. The bar graphs provide a visual representation of the coverage.

Use two color bar graphs (red, blue).   Causes the report to use red and blue bar graphs instead of black and white. The color graphs might not print well in black and white.

Display hit/count ratio in the model summary.   Reports coverage numbers as both a percentage and a ratio, e.g., 67% (8/12).

Do not report fully covered model objects.   Causes the coverage report to include only model objects that the simulation does not cover fully. This option is useful when you are developing tests, because it reduces the size of the generated reports.

Include cyclomatic complexity numbers in summary.   Includes the cyclomatic complexity (see Types of Model Coverage) of the model and its top-level subsystems and charts in the report summary. A cyclomatic complexity number shown in boldface indicates that the analysis considered the subsystem itself to be an object when computing its complexity. This occurs for atomic and conditionally executed subsystems as well as Stateflow® Chart blocks.

Include cyclomatic complexity numbers in block details.   Includes the cyclomatic complexity metric in the block details section of the report.

Cumulative Runs

Display the coverage results from successive simulations in the report.

Whenever the check box Save cumulative results in workspace variable in the Results pane is selected, a coverage running total is updated with new results at the end of each simulation. In a cumulative coverage report the results in the rightmost column reflect that running total value. The report is organized so that you can easily compare the additional coverage from the most recent run with the coverage from all prior runs in the session.

You can make cumulative coverage results persist between MATLAB sessions by using cvsave to save results to a file at the end of the session and cvload to load the results at the beginning of the session. Note that the cvload parameter RESTORETOTAL must be 1 in order to restore cumulative results.

When you save the coverage results to a file using cvsave and a model name argument, the file also contains the cumulative running total. When you load that file back into the coverage tool using cvload, you can select whether you want to restore the running total from the file.

When you restore a running total from saved data, the saved results are reflected in the next cumulative report that is generated. If a running total already exists when you restore a saved value, the existing value is overwritten.

Whenever you report on more than a single simulation, the coverage displayed for truth tables and lookup-table maps is based on the total coverage of all the reported runs. In the case of a cumulative report, this includes all the simulations where cumulative results were stored.

Calculating cumulative coverage results is also possible at the command line via the + operator. The following script demonstrates this usage:

covdata1 = cvsim(test1);
covdata2 = cvsim(test2);
cvhtml('cumulative_report', covdata + covdata2);

Last Run

Display only the results of the most recent simulation run in the report.

Additional Data to Include in Report

Lets you specify names of coverage data from previous runs to include in the current report along with the current coverage data. Each entry causes a new set of columns to appear in the report.

Options Tab

You select important options for model coverage reports in the Options pane of the Coverage Settings dialog box.

Treat Simulink® Logic Blocks as Short-Circuited

Applies only to condition and MC/DC coverage. If enabled, coverage analysis treats Simulink logic blocks as though they short-circuit their input. In other words, the coverage tool treats such a block as if the block ignores remaining inputs when the previous inputs alone determine the block's output. For example, if the first input to a Logical Operator block whose Operator parameter specifies AND is false, MC/DC coverage analysis ignores the values of the other inputs when determining MC/DC coverage for a test case.

You should select this option if you plan to generate code from a model and want the MC/DC coverage analysis to approximate the degree of coverage that your test cases would achieve for the generated code (most high-level languages short-circuit logic expressions).

Warn When Unsupported Blocks Exist in a Model

Select this option if you want the tool to warn you at the end of the simulation if the model contains blocks that require coverage analysis but are not currently covered by the tool.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS