Documentation

Create and Run Test Cases

To create and run test cases, model coverage provides the MATLAB® commands cvtest and cvsim. The cvtest command creates test cases that the cvsim command runs. (See Run Tests with cvsim.)

You can also run the coverage tool interactively:

  1. Open the sldemo_fuelsys model.

  2. In the Simulink® model window, select Analysis > Coverage > Settings.

    In the Configuration Parameters dialog box, on the Coverage Pane, select Enable coverage analysis, which enables the coverage settings.

  3. Under Coverage metrics, select the types of coverage that you want to record in the coverage report. Click OK.

  4. In the Simulink Editor, select Simulation > Run to start simulating the model.

    On the Results Pane of the Configuration Parameters dialog box, if you specify to report model coverage, Simulink Coverage™ saves coverage data for the current run in the workspace object covdata and cumulative coverage data in covCumulativeData, by default. Simulink Coverage also saves these results to a .cvt file by default. At the end of the simulation, the data appears in an HTML report that opens in a browser window. For more information on coverage data settings, see Specify Coverage Options.

    You cannot run simulations if you select both the model coverage reporting and acceleration options. In the Simulink Editor, if you select Simulation > Mode > Accelerator , Simulink Coverage does not record coverage.

    When you perform coverage analysis, you cannot select both block reduction and conditional branch input optimization, because they interfere with coverage recording.

Was this topic helpful?