Main Content

sldvmakeharness

Generate harness model

Description

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

[savedHarnessFilePath] = sldvmakeharness(model, dataFile) generates a test harness from the data file dataFile.

example

[savedHarnessFilePath] = sldvmakeharness(model, dataFile, harnessOpts) generates a test harness from model by using the dataFile and the harnessOpts, which specifies the harness creation options. If the dataFile is not available, requires '' for dataFile.

If the software generates a harness, it does not imply that your model is compatible with the Simulink Design Verifier™ software.

Examples

collapse all

Create a test harness for the sldvdemo_cruise_control model by using the default options.

Open the sldvdemo_cruise_control model by using the default options and create a harness model:

open_system('sldvdemo_cruise_control');
harnessopts=sldvharnessopts();
[harnessfile] = sldvmakeharness('sldvdemo_cruise_control', '', harnessopts);

Input Arguments

collapse all

Handle to a Simulink model or the model name.

Name of the sldvData file.

A structure whose fields specify these configurations for sldvmakeharness, as listed in this table.

FieldDescription
harnessFilePath

Specifies the file path for creating the harness model. If an invalid path is specified, sldvmakeharness does not save the harness model, but it creates and opens the harness model. If this option is not specified, sldvmakeharness 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 only input signals used in the model. model must be compatible with the software to detect the used input signals.

When the harnessSource parameter is set to Signal Editor, the Signal Editor block in the harness model consists of unused bus signals in addition to the input signals in the model.

Default: false

harnessSource

When set to Signal Builder, Simulink Design Verifier generates a harness model with the Signal Builder block as the Inputs block.

When set to Signal Editor, Simulink Design Verifier generates a harness model with the Signal Editor block as the Inputs block.

Default: Signal Builder

Note

To create a default harnessOpts object, use sldvharnessopts.

Output Arguments

collapse all

The path and file name of the generated harness model.

Alternatives

sldvmakeharness creates a test harness model without analyzing the model. To analyze the model and create a test harness:

  1. Open the model.

  2. On the Design Verifier tab, in the Prepare section, from the drop-down menu for the mode settings, click Settings.

  3. In the Configuration Parameters dialog box, on the Design Verifier > Results pane, in Harness model options, set the options that you want.

  4. Click OK.

  5. To perform test generation analysis, on the Design Verifier tab, in the Mode section, select Test Generation.

  6. Click Generate Tests.

Introduced in R2009b