Documentation

slvnvmakeharness

Generate Simulink Coverage harness model

Syntax

harnessFilePath = slvnvmakeharness(model)
harnessFilePath = slvnvmakeharness(model, dataFile)
harnessFilePath = slvnvmakeharness(model, dataFile, harnessOpts)

Description

harnessFilePath = slvnvmakeharness(model) generates a test harness from model, which is a handle to a Simulink® model or a character vector with the model name. slvnvmakeharness returns the path and file name of the generated harness model in harnessFilePath. slvnvmakeharness creates an empty harness model. The test harness includes one default test case that specifies the default values for all input signals.

harnessFilePath = slvnvmakeharness(model, dataFile) generates a test harness from the data file dataFile.

harnessFilePath = slvnvmakeharness(model, dataFile, harnessOpts) generates a test harness from model by using the dataFile and harnessOpts, which specifies the harness creation options. Requires '' for dataFile if dataFile is not available. The default dataFile argument creates a test harness with a single test case with default values for the inputs.

Input Arguments

collapse all

Simulink model or the model name.

Contains information about the model, its input and output ports, and any preexisting test signals. This argument can be either the structure itself or the name of the .mat file containing this structure. Use this parameter when you have previously logged test data that you want to import into a new test harness.

A structure whose fields specify the configuration for slvnvmakeharness.

FieldDescription
harnessFilePath

Specifies the file path for creating the harness model. If an invalid path is specified, slvnvmakeharness does not save the harness model, but it creates and opens the harness model. If you do not specify this option, the slvnvoptions object is used. Also, slvnvmakeharness generates a new harness model and saves it in the MATLAB® current folder.

Default: ''

modelRefHarness

Generates the test harness model that includes model in a Model block. When false, the test harness model includes a copy of model.

Default: true

usedSignalsOnly

When true, the Signal Builder block in the harness model has signals for input signals in the model. You must have the Simulink Design Verifier™ software and model must be compatible with that software to detect the input signals.

Default: false

Note

To create a default harnessOpts object, at the MATLAB command prompt, type:

slvnvharnessopts

Output Arguments

collapse all

The path and file name of the generated harness model.

Examples

Create a Test Harness Using the Default Options

Create a test harness for the sldemo_mdlref_house model using the default options:

open_system('sldemo_mdlref_house');
[harnessfile] = slvnvmakeharness('sldemo_mdlref_house', '', harnessOpts);

Introduced in R2010b

Was this topic helpful?