Documentation

sltest.import.sldvData

Create test cases from Simulink Design Verifier results

Syntax

[owner,testHarness,testFile] = sltest.import.sldvData(dataFile)
[owner,testHarness,testFile] = sltest.import.sldvData(dataFile,Name,Value)

Description

[owner,testHarness,testFile] = sltest.import.sldvData(dataFile) creates a test harness and test file using Simulink® Design Verifier™ analysis results contained in dataFile. The function returns the model component owner associated with the test case, the testHarness, and the testFile.

[owner,testHarness,testFile] = sltest.import.sldvData(dataFile,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Create a test file and test harness for the ShiftLogic subsystem in the sldvdemo_autotrans model. The inputs reflect the analysis objectives.

Analyze the ShiftLogic subsystem with Simulink Design Verifier to generate test inputs for subsystem coverage. The results data file is ShiftLogic_sldvdata.mat.

Create the test case.

[component,harness,testfile] = sltest.import.sldvData...
('./sldv_output/ShiftLogic/ShiftLogic_sldvdata.mat','TestHarnessName',...
'CoverageHarness','TestFileName','CoverageTests')

Open the test harness.

sltest.harness.open(component,harness)

Open the test file.

open(testfile)

Create a test file and test harness for the ShiftLogic subsystem in the sldvdemo_autotrans model, using an existing test harness.

Analyze the ShiftLogic subsystem with Simulink Design Verifier to generate test inputs for subsystem coverage. The results data file is ShiftLogic_sldvdata.mat. The existing test harness is named DatafileHarness.

Create the test case.

[component,harness,testfile] = sltest.import.sldvData...
('./sldv_output/ShiftLogic/ShiftLogic_sldvdata.mat',...
'TestHarnessName','DatafileHarness','TestFileName','CoverageTests',...
'CreateHarness',false)

Open the test harness.

sltest.harness.open(component,harness)

Open the test file.

open(testfile)

Input Arguments

collapse all

Path and file name of the data file generated by Simulink Design Verifier analysis, specified as a character vector.

Example: 'ShiftLogic0/ShiftLogic0_sldvdata.mat'

Example: 'Controller_sldvdata.mat'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'TestHarnessName','DatafileHarness','CreateHarness',false

collapse all

Option to add a test harness to the model or model component, which corresponds to the test cases in the test file, specified as a comma-separated pair consisting of 'CreateHarness' and true or false.

If you specify true, use a new test harness name with the 'TestHarnessName' name-value pair.

If you specify false, use an existing test harness name with the 'TestHarnessName' name-value pair.

Note

If the model under analysis is a test harness, the CreateHarness default value is false.

Example:

'CreateHarness',false

The test harness used for running the test cases, specified as the comma-separated pair consisting of 'TestHarnessName' and the name of a test harness.

Use a new test harness name if 'CreateHarness' is true and an existing test harness name if 'CreateHarness' is false.

Example:

'TestHarnessName','ModelCoverageTestHarness'

The name for the test file created for the test cases, specified as the comma-separated pair consisting of 'TestFileName' and the name of a test file.

Example:

'TestFileName','ModelCoverageTests'

The path to the model extracted from Simulink Design Verifier analysis, specified as the comma-separated pair consisting of 'ExtractedModelPath' and a path.

Simulink Test™ uses the extracted model to generate the test harness. By default, sltest.import.sldvData looks for the extracted model in the output folder specified in the Design Verifier configuration parameters. Use ExtractedModelPath if the extracted model is in a different location.

Simulink Design Verifier does not use an extracted model when you analyze a top-level model. When you generate test cases for a top-level model, Simulink Test does not use 'ExtractedModelPath'.

Example:

'Tests/ExtractedModels/'

Introduced in R2015b

Was this topic helpful?