setProperty
Class: sltest.testmanager.TestCase
Package: sltest.testmanager
Set test case property
Syntax
setProperty(tc,Name,Value)
Description
setProperty(
sets a test case property.tc
,Name,Value
)
Input Arguments
tc
— Test case
sltest.testmanager.TestCase
object
Test case to set property, specified as an sltest.testmanager.TestCase
object.
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: 'StopTime',100
Model
— System Under Test model name
empty character vector (default)
The model name in the System Under Test section, specified as a character vector.
Example: 'sldemo_absbrake'
SimulationMode
— Simulation mode
empty character vector (default) | 'Normal'
| 'Accelerator'
| 'Rapid Accelerator'
| 'Software-in-the-Loop (SIL)'
| 'Processor-in-the-Loop (PIL)'
The simulation mode of the model or harness, specified as a character
vector. To return to the default model settings, specify an empty
character vector, ''
.
Example: 'SimulationMode','Rapid
Accelerator'
OverrideSILPILMode
— Override SIL or PIL mode
false
or
0
(default) | true
or 1
Override SIL/PIL simulation mode of model blocks to Normal simulation
mode, specified as a numeric or logical 1
(true
) or 0
(false
). If this property is
true
or 1, the associated check box in the
Simulation Settings Overrides section of the Test Manager is
selected.
OverrideStartTime
— Override model start time
false
or
0
(default) | true
or 1
Indicate if the test case overrides the model start time, specified as
a numeric or logical 1
(true
) or
0
(false
).
StartTime
— Model start time
0
(default) | scalar
Model start time, specified as a scalar value.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
OverrideStopTime
— Override model stop time
false
or
0
(default) | true
or 1
Indicate if the test case overrides the model stop time, specified as
a numeric or logical 1
(true
) or
0
(false
).
StopTime
— Model stop time
10
(default) | scalar
Model stop time, specified as a scalar value.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
OverrideInitialState
— Override model initial state
false
or
0
(default) | true
or 1
Indicate if the test case overrides the model initial state, specified
as a numeric or logical 1
(true
)
or 0
(false
).
InitialState
— Model initial state
empty character vector (default)
Model initial state from a workspace variable, specified as a character vector.
HarnessName
— Test harness name
empty character vector (default)
Name of a test harness to use in the System Under Test section, specified as a character vector.
HarnessOwner
— Test harness owner name
empty character vector (default)
Name of the test harness owner, specified as a character vector.
ComponentUnderTestName
— Name of Model block to test
Simulink.BlockPath
object
Name of Model block to test, specified as a Simulink.BlockPath
object. For the block path, include the full path starting from the top
model. The Model block can be at
any level in the model or test harness
hierarchy. When the test case runs the whole top-level model or harness,
it tests the specified Model block in context. However,
the coverage results include only the results for the tested
Model block.
UseSignalEditorScenarios
— Override Signal Editor scenarios
false
or
0
(default) | true
or 1
Indicate if the test case overrides the model and uses different
Signal Editor scenarios in the Inputs section, specified as a numeric or
logical 1
(true
) or
0
(false
).
SignalEditorScenario
— Signal Editor scenario name
empty character vector (default)
Signal Editor scenario name, specified as a character vector. To
return to the default model settings, specify an empty character vector,
''
.
IsTestDataReferenced
— Use external file to create test case
false
or
0
(default) | true
or 1
Whether to use test data from an external file, such as an
Excel® or MAT file, to create the test case, specified as a
numeric or logical 1
(true
) or
0
(false
). If
isTestDataReferenced
is true
or 1
, use TestDataPath
to specify
the path to file.
TestDataPath
— Path to external file for test case
character vector
Path to the external file being referenced for creating the test case, specified as a character vector.
Adapter
— Function to convert Excel or MAT file test data
function handle
Function to convert Excel or MAT file test data to a format supported
by the Test Manager, specified as a function handle. See sltest.testmanager.registerTestAdapter
for more
information.
SDIViewFile
— Path to Simulation Data Inspector view file for test case
character vector
Path to the Simulation Data Inspector (SDI) view file for a test case,
specified as a character vector. The view file specifies which signals
to plot and their layout in the test case results. The Test Manager does
not support some configurations in an SDI view file, such as axes plot
layouts other than time plots and axes layouts other than
N-by-M grids. However, the
Test Manager applies a similar configuration, if possible. You can
assign a different view file to each test case in a test file. Use
Simulink.sdi.saveView
to create and save an SDI view
file. For more information, see Save and Share Simulation Data Inspector Data and Views.
TestSequenceBlock
— Test Sequence block path
character vector
Test Sequence block path, specified as a character vector. The
specified block contains the test sequence scenarios to use in the test
case. Specify TestSequenceBlock
and
TestSequenceScenario
to run a scenario other than
the active scenario. If you do not specify a value for
TestSequenceScenario
, the test runs the active
scenario in the Test Sequence block. If your Test Sequence block does
not have scenarios, the test runs the single test sequence in the block.
TestSequenceScenario
— Test Sequence scenario name
character vector
Test Sequence scenario name, specified as a character vector. The
specified test sequence scenario runs instead of the active scenario or,
if you are using iterations, the scenario runs as the default scenario
for all iterations. Use setTestParam
to assign a
different scenario to an iteration. You must specify
TestSequenceBlock
to use
TestSequenceScenario
.
Release
— Release on which to run the test case
Current
(default) | string
| character vector
| cell array
| string array
Release on which to run the test case, specified as a string,
character vector, or cell array. For equivalence tests, you can specify
only one release for each simulation index, for example,
('Release',releaseNames{1},'SimulationIndex',1)
.
For other test types, you can specify multiple releases as a cell or
string array, for example, ('Release',releaseNames)
,
where releaseNames
is a cell array, such as
{'Current','R2020a'}
.
OverrideModelOutputSettings
— Override model output settings
false
or
0
(default) | true
or 1
Indicate if the test case overrides the model settings under the
Outputs section, specified as a numeric or logical 1
(true
) or 0
(false
).
SaveOutput
— Override saving output
false
or
0
(default) | true
or 1
Indicate if the test case overrides saving model output, specified as
a numeric or logical 1
(true
) or
0
(false
).
SaveState
— Save output state values
false
or
0
(default) | true
or 1
Indicate if the test case is set to save output state values,
specified as a numeric or logical 1
(true
) or 0
(false
).
SignalLogging
— Log signals
true
or
1
(default) | false
or 0
Indicate if the test case is set to log signals marked for logging in
the model, specified as a numeric or logical 1
(true
) or 0
(false
).
DSMLogging
— Log Data Store variables
true
or
1
(default) | false
or 0
Indicate if the test case is set to log Data Store variables,
specified as a numeric or logical 1
(true
) or 0
(false
).
SaveFinalState
— Save final state
false
or
0
(default) | true
or 1
Indicate if the test case is set to store final state values,
specified as a numeric or logical 1
(true
) or 0
(false
).
SimulationIndex
— Equivalence test case simulation
1
(default) | 2
Simulation number that the property applies to, specified as an
integer, 1
or 2
. This setting
applies to the simulation test case.
ConfigSetOverrideSetting
— Configuration setting override
1
(default) | 2
| 3
Override the configuration settings, specified as an integer.
1
— No override2
— Use a named configuration set in the model3
— Use a configuration set specified in a file
ConfigSetName
— Configuration set name
empty character vector (default)
Name of the configuration setting in a model, specified as a character vector.
ConfigSetVarName
— Configuration set variable name
empty character vector (default)
Variable name in a configuration set file, specified as a character vector.
ConfigSetFileLocation
— Configuration set file path
empty character vector (default)
Filename and path of the configuration set, specified as a character vector.
PreloadCallback
— Pre-load callback script
character vector
Pre-load callback script, specified as a character vector.
PostloadCallback
— Post-load callback script
character vector
Post-load callback script, specified as a character vector.
CleanupCallback
— Cleanup callback script
character vector
Test-case level cleanup callback script, specified as a character vector. The function deletes any existing callback script and replaces it with the specified character vector.
Example: 'clear a % clear value from
workspace'
PreStartRealTimeApplicationCallback
— Real-time pre-start callback
character vector
Character vector evaluated before the real-time application is started on the target computer, specified as a character vector. For more information on real-time testing, see Test Models in Real Time.
IterationScript
— Iteration script
character vector
Iteration script evaluated to create test case iterations, specified as a character vector. For more information about test iteration scripts, see Test Iterations.
FastRestart
— Run iterations using fast restart
false
or
0
(default) | true
or 1
Indicate if the test iterations run using fast restart mode, specified
as a numeric or logical 1
(true
)
or 0
(false
).
SaveBaselineRunInTestResult
— Save baseline in test result
false
(default) | true
Indicate if the test case saves the baseline used in the test result
after test execution, specified as a numeric or logical
1
(true
) or
0
(false
).
SaveInputRunInTestResult
— Save input in test result
false
or
0
(default) | true
or 1
Enable saving external input run used in test result, specified as a
numeric or logical 1
(true
) or
0
(false
).
StopSimAtLastTimePoint
— Stop simulation at last input time
false
or
0
(default) | true
or 1
Enable stopping the simulation at the final time value of the input,
specified as a numeric or logical 1
(true
) or 0
(false
).
LoadAppFrom
— Application location
1
(default) | 2
| 3
Location from which to load the application, specified as an integer. This property is available only in real-time test cases.
1
— Model2
— Target application3
— Target computer
For more information on real-time testing, see Test Models in Real Time.
TargetComputer
— Target computer name
character vector
Name of the target computer, specified as a character vector. This property is available only in real-time test cases. For more information on real-time testing, see Test Models in Real Time.
TargetApplication
— Target application name and path
character vector
Name and path of the target application, specified as a character vector. This property is available only in real-time test cases. For more information on real-time testing, see Test Models in Real Time.
Examples
Set Model as System Under Test
% Create the test file, test suite, and test case structure tf = sltest.testmanager.TestFile('API Test File'); ts = createTestSuite(tf,'API Test Suite'); tc = createTestCase(ts,'baseline','Baseline API Test Case'); % Remove the default test suite tsDel = getTestSuiteByName(tf,'New Test Suite 1'); remove(tsDel); % Assign the system under test to the test case setProperty(tc,'Model','sldemo_absbrake');
Version History
Introduced in R2015bR2023a: New property for Model block name
Use the ComponentUnderTestName
property to specify the Model
block to test. The Model block can be at any level
of the model or test harness hierarchy.
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)