sltest.testmanager.TestCase Class
Namespace: sltest.testmanager
Create or modify test case
Description
Instances of sltest.testmanager.TestCase
are test case objects.
If you want to modify the test case settings that define how the test case executes, use
the setProperty
and getProperty
methods.
For MATLAB®-based Simulink® tests, test methods defined in the class file correspond to test cases. See Test Models Using MATLAB-Based Simulink Tests for more information.
The sltest.testmanager.TestCase
class is a handle
class.
Creation
Description
creates a obj
= sltest.testmanager.TestCase(parent
,testtype
,name
)sltest.testmanager.TestCase
object with the specified
TestType
and test case Name
.
Properties
Parent
— Parent test suite
sltest.testmanager.TestSuite
object
Test suite that is the parent of the specified test case, specified as an sltest.testmanager.TestSuite
object.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: sltest.testmanager.TestSuite
TestType
— Test case type
'baseline'
(default) | 'equivalence'
| 'simulation'
The test case type, specified as 'baseline'
,
'equivalence'
, or 'simulation'
.
Baseline tests compare outputs from a simulation to expected results stored as baseline data. To compare the test results of multiple models, you can compare the test results of each model to the same baseline data.
Equivalence tests compare the outputs from two different simulations. Simulations can run in different modes, such as normal simulation and software-in-the-loop. You cannot compare more than two models in a single equivalence test case.
Simulation tests run the system under test and capture simulation data. If the system under test contains blocks that verify simulation, such as Test Sequence and Test Assessment blocks, pass/fail results are reflected in the simulation test results.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
Name
— Test case name
character vector
Name of the test case, specified as a character vector. If you do not specify a name, a unique name is created.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: char
Description
— Test case description
character vector
Test case description text, returned as a character vector.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: char
Enabled
— Test execution indicator
true
or 1
| false
or 0
Indicates if the test case will execute, specified as a logical value
true
or 1
, or false
or
0
.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: logical
ReasonForDisabling
— Disabled description
character vector
Description text for why the test file was disabled, specified as a character
vector. This property is visible only when the Enabled
property is
set to false
.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: char
Requirements
— Test file requirements
structure array
Requirements that are attached at the test-file level, returned as a structure.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: struct
RunOnTarget
— Target indicator
cell array
Indicates if the test case simulation runs on a target, returned as a cell array of logical values. For more information on real-time testing, see Test Models in Real Time
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: logical
Tags
— Tags for categorizing
character vector | string array
Tags to use for categorizing, specified as a character vector or string array.
Attributes:
GetAccess | public |
SetAccess | public |
Dependent | true |
NonCopyable | true |
Data Types: char
| string
TestFile
— Parent test file
sltest.testmanager.TestFile
object
Test file that is the parent of the test case, returned as an sltest.testmanager.TestFile
object.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: sltest.testmanager.TestFile
TestPath
— Test hierarchy
character vector
Test file, test suite, and test case hierarchy, returned as a character vector.
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
Methods
Public Methods
addBaselineCriteria | Add baseline criteria to test case |
addFaultSet | Add fault set to test case |
addInput | Add input file to test case |
addIteration | Add test iteration to test case |
addLoggedSignalSet | Add logged signal set to a test case |
addParameterSet | Add parameter set |
captureBaselineCriteria | Capture baseline criteria and add to test case |
captureEquivalenceCriteria | Capture equivalence criteria and add to test case |
convertTestType | Convert test from one type to another |
copySimulationSettings | Copy simulation setting in equivalence test case |
createInputDataFile | Create file as basis for test case input signal data |
deleteIterations | Delete test iterations that belong to test case |
getAssessmentsCallback | Get test case assessments callback |
getBaselineCriteria | Get baseline criteria |
getCoverageSettings | Get coverage settings |
getCustomCriteria | Get custom criteria that belong to test case |
getEquivalenceCriteria | Get equivalence criteria from test case |
getFaultSets | Get fault sets in test case |
getInputs | Get test case inputs |
getIterations | Get test iterations that belong to test case |
getLoggedSignalSets | Get logged signal set from a test case |
getOptions | Get test file options |
getOutputTrigger | Create output trigger object for test case |
getParameterSets | Get test case parameter sets |
getProperty | Get test case property |
getTestCaseResults | Get test case results history |
remove (test case) | Remove test case |
run | Run test case |
setProperty | Set test case property |
setAssessmentsCallback | Set test case assessment callback |
addAssessment | Add assessments to a test case |
getAssessments | Get assessments associated with test case |
addAssessmentSymbol | Add assessment symbols to a test case |
getAssessmentSymbols | Get assessment symbols associated with test case |
Examples
Create New Test File, Test Suite, and Test Case
% Create test file testfile = sltest.testmanager.TestFile('C:\MATLAB\test_file.mldatx'); % Create test suite testsuite = sltest.testmanager.TestSuite(testfile,'My Test Suite'); % Create test case testcase = sltest.testmanager.TestCase(testsuite,'equivalence',... 'Equivalence Test Case')
testcase = TestCase with properties: Name: 'Equivalence Test Case' TestFile: [1×1 sltest.testmanager.TestFile] TestPath: 'test_file > My Test Suite > Equivalence Test Case' TestType: 'equivalence' RunOnTarget: {2×1 cell} RunOnPlatform: {[Desktop] [Desktop]} Parent: [1×1 sltest.testmanager.TestSuite] Requirements: [0×1 struct] Description: '' Enabled: 1 Tags: [0×0 string]
Version History
Introduced in R2015bR2024a: Add and get fault sets
Use the addFaultSet
method to create a fault set and a sltest.testmanager.FaultSet
object for a test case. Retrieve existing fault sets
in a test case by using the getFaultSets
method. Use fault sets to specify the active Simulink
Fault Analyzer™ faults in test cases.
You must have Simulink Fault Analyzer to use these methods.
R2023a: New method to create a trigger object
Use the new getOutputTriggerResults
method to create an sltest.testmanager.OutputTrigger
object for a test case. Triggers control when
signals are logged.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)