sltest.import.sldvData
Create test cases from Simulink Design Verifier results
Syntax
Description
[
creates a test harness and test file using Simulink®
Design Verifier™ analysis results contained in owner
,testHarness
,testFile
,testCase
]
= sltest.import.sldvData(dataFile
)dataFile
. The function
returns the model component owner
associated with the test case, the
testHarness
, and the testFile
.
[
creates a test harness and test file with additional options specified by one or more
owner
,testHarness
,testFile
,testCase
]
= sltest.import.sldvData(dataFile
,Name,Value
)Name,Value
pair arguments. Specify name-value pair arguments after
the data file input argument.
Examples
Create Test Cases for ShiftLogic Subsystem
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 Test Cases for ShiftLogic Subsystem Using an Existing Test Harness
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
dataFile
— Data file full pathname
character vector | string scalar
Path and filename of the data file generated by Simulink
Design Verifier analysis, specified as a character vector or string scalar. The input file
is a MAT file. When the file is imported into Simulink
Test™, sldvData creates an MLDATX file, and an Excel® file at the location specified in ExcelFilePath
. If the
Excel file already exists, a new sheet is added to the file.
Example: 'ShiftLogic0/ShiftLogic0_sldvdata.mat'
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'TestHarnessName','DatafileHarness','CreateHarness',false
CreateHarness
— Create a test harness for the model or subsystem
true
(default) | false
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
TestHarnessName
— Harness name
character vector | string scalar
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'
TestHarnessSource
— Source of the new test harness
'Inport'
(default) | 'Signal Editor'
The source of the new test harness, specified as the comma-separated pair
consisting of 'TestHarnessSource'
and 'Inport'
or 'Signal Editor'
.
Use a new test harness name if 'CreateHarness'
is
true
and an existing test harness name if
'CreateHarness'
is false
.
Example: 'TestHarnessName','ModelCoverageTestHarness'
TestFileName
— Test filename
character vector | string scalar
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'
ExtractedModelPath
— Path of extracted model
character vector | string scalar
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/'
TestCase
— Test case
character vector | string scalar
The test case to reuse for import operation, specified as the comma-separated pair
consisting of 'TestCase'
and the name of the test case. Do not
specify any other name-value pair when you use this
option.
Example: 'TestCase','ModelCoverageTest2'
ExcelFilePath
— Path of Excel file
character vector | string scalar
Path of the Excel file, specified as a character vector or string scalar.
Example: 'ExcelFilePath','ShiftLogic_sldvdata.xlsx'
Output Arguments
owner
— Path of the component under test
character vector | string scalar
Path of the component under test, returned as a character vector
Example: 'ShiftLogic0/ShiftLogic0_sldvdata'
testHarness
— Test harness name
character vector
Name of the test harness for running the test cases, returned as a character vector.
testFile
— Test filename
character vector
Name of the test file created or updated using the test cases, returned as a character vector.
testCase
— Test case name
character vector | string scalar
Name of the newly created or updated test case, returned as a character vector.
Version History
Introduced in R2015b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)