Documentation

Create Tests with cvtest

The cvtest command creates a test specification object. Once you create the object, you simulate it with the cvsim command.

The call to cvtest has the following default syntax:

cvto = cvtest(root)

root is the name of, or a handle to, a Simulink® model or a subsystem of a model. cvto is a handle to the resulting test specification object. Only the specified model or subsystem and its descendants are subject to model coverage.

To create a test object with a specified label (used for reporting results):

cvto = cvtest(root, label)

To create a test with a setup command:

cvto = cvtest(root, label, setupcmd)

You execute the setup command in the base MATLAB® workspace, just prior to running the instrumented simulation. Use this command for loading data prior to a test.

The returned cvtest object, cvto, has the following structure.

Field

Description

id

Read-only internal data-dictionary ID

modelcov

Read-only internal data-dictionary ID

rootPath

Name of the system or subsystem for analysis

label

String for reporting results

setupCmd

Command executed prior to simulation

settings.condition

Set to 1 for condition coverage

settings.decision

Set to 1 for decision coverage

settings.
designverifier

Set to 1 for coverage for Simulink Design Verifier™ blocks.

settings.mcdc

Set to 1 for MCDC coverage

settings.overflowsaturation

Set to 1 for saturate on integer overflow coverage

settings.sigrange

Set to 1 for signal range coverage

settings.sigsize

Set to 1 for signal size coverage.

settings.tableExec

Set to 1 for lookup table coverage

modelRefSettings.enable

String specifying one of the following values:

  • Off — Disables coverage for all referenced models

  • all — Enables coverage for all referenced models

  • filtered — Enables coverage for only referenced models not listed in the excludedModels subfield

modelRefSettings.
excludeTopModel

Set to 1 for excluding coverage for the top model

modelRefSettings.
excludedModels

String specifying a comma-separated list of referenced models for which coverage is disabled when modelRefSettings.enable specifies filtered

emlSettings.
enableExternal

Set to 1 to enable coverage for external program files called by MATLAB functions in your model

sfcnSettings.
enableSfcn

Set to 1 to enable coverage for C/C++ S-Function blocks in your model.

options.
forceBlockReduction

Set to 1 to override the Simulink Block reduction parameter if it is enabled.

Was this topic helpful?