setProperty
Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager
Set test case property
Syntax
setProperty(tc,Name=Value)
Description
setProperty(
sets a test case property specified by tc
,Name
=Value
)Name
to the value specified
by Value
for the test case tc
.
Input Arguments
Test case to set property for, 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.
The model name in the System Under Test section, specified as a character vector.
Example: 'sldemo_absbrake'
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'
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.
Indicate if the test case overrides the model start time, specified as
a numeric or logical 1
(true
) or
0
(false
).
Model start time, specified as a scalar value.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Indicate if the test case overrides the model stop time, specified as
a numeric or logical 1
(true
) or
0
(false
).
Model stop time, specified as a scalar value.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Stop simulation at last input time point instead of at the
Stop Time model setting, specified as numeric
or logical 1
(true
) or
0
(false
).
Data Types: logical
Indicate if the test case overrides the model initial state, specified
as a numeric or logical 1
(true
)
or 0
(false
).
Model initial state from a workspace variable, specified as a character vector.
Name of a test harness to use in the System Under Test section, specified as a character vector.
Name of the test harness owner, specified as a character vector.
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.
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
).
Signal Editor scenario name, specified as a character vector. To
return to the default model settings, specify an empty character vector,
''
.
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.
Path to the external file being referenced for creating the test case, specified as a character vector.
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.
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.
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.
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 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'}
.
Indicate if the test case overrides the model settings under the
Outputs section, specified as a numeric or logical 1
(true
) or 0
(false
).
Indicate if the test case overrides saving model output, specified as
a numeric or logical 1
(true
) or
0
(false
).
Indicate if the test case is set to save output state values,
specified as a numeric or logical 1
(true
) or 0
(false
).
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
).
Indicate if the test case is set to log Data Store variables,
specified as a numeric or logical 1
(true
) or 0
(false
).
Indicate if the test case is set to store final state values,
specified as a numeric or logical 1
(true
) or 0
(false
).
Simulation number that the property applies to, specified as an
integer, 1
or 2
. This setting
applies to the simulation test case.
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
Name of the configuration setting in a model, specified as a character vector.
Variable name in a configuration set file, specified as a character vector.
Filename and path of the configuration set, specified as a character vector.
Since R2024a
Name of variant configuration to apply to the model before running the test case, specified as a string or character vector.
This property applies to models that use variant elements such as variant blocks and variant parameters, and also have variant configurations created for the model using Variant Manager for Simulink®. For such a model, you can specify a variant configuration that can activate a specific variant path across the model hierarchy before the test runs.
For an example, see Run Tests for Variant Models Using Variant Configurations.
Pre-load callback script, specified as a character vector.
Post-load callback script, specified as a 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'
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.
Iteration script evaluated to create test case iterations, specified as a character vector. For more information about test iteration scripts, see Test Iterations.
Indicate if the test iterations run using fast restart mode, specified
as a numeric or logical 1
(true
)
or 0
(false
).
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
).
Enable saving external input run used in test result, specified as a
numeric or logical 1
(true
) or
0
(false
).
Enable stopping the simulation at the final time value of the input,
specified as a numeric or logical 1
(true
) or 0
(false
).
Enable plotting the logged signals when the simulation is complete,
specified as a numeric or logical 1
(true
) or 0
(false
).
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.
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.
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.
RoadRunner application installation folder, specified as a string or character vector. This property applies only to RoadRunner test cases.
RoadRunner project folder, specified as a string or character vector. This property applies only to RoadRunner test cases.
Path to RoadRunner scenario file, specified as a string or character vector. This property applies only to RoadRunner test cases.
Option to run RoadRunner scenario in console mode, specified as a
numeric or logical 1
(true
) or
0
(false
). Set this property
to false
or 0
to run the scenario
in graphical mode, which displays the RoadRunner application as it runs
the scenario. When the property value is 1
or
true
, the RoadRunner application runs in the
background. This property applies only to RoadRunner test cases.
Option to set RoadRunner pacing, specified as a numeric or logical
1
(true
) or
0
(false
). When
RoadRunnerTurnOffPacing
is 1
or true
, the pacing is off and the scenario runs at
its normal speed. Set this property to false
or
0
to enable changing the speed at which the
scenario runs. This property applies only to RoadRunner test
cases.
Option to stop execution of a test case when an iteration fails,
specified as a numeric or logical 1
(true
) or 0
(false
). When StopOnFailure
is
0
(false
), the Test
Manager executes all test
iterations in the RoadRunner test case. When
StopOnFailure
is 1
(true
), the Test Manager stops execution of the
RoadRunner test case when an iteration fails.
Any subsequent iterations in the test
case remain untested and the Test Manager executes remaining
test cases. This property applies only to RoadRunner test cases and is
not supported for tests executed in parallel.
Option to override default RoadRunner path settings, specified as a
numeric or logical 1
(true
) or
0
(false
). Set this property
to true
or 1
to use the settings
that you specify using the API instead of in the Test Manager, or to
false
or 0
to use the settings
in the Test Manager. This property applies only to RoadRunner test
cases.
Since R2025a
Sequence diagram to simulate during test execution, specified as a string scalar or character vector. This property applies to baseline and simulation test cases. When you run the test, the results in the Test Manager include the sequence diagram results.
To simulate more than one sequence diagram during test execution, use
test iterations. For more information, see setTestParam
.
Examples
% 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 R2015bUse the SequenceDiagram
property to specify the sequence
diagram to simulate during test execution. You can set this property for baseline
and simulation test cases.
Use the StopOnFailure
property to specify whether to stop the
execution of a RoadRunner test case when an iteration fails.
Use the StopSimAtLastTimePoint
property to stop simulation at
the last input time point instead of the model Stop
Time.
Use the OverrideRoadRunnerDefaultSettings
property to
override the default file and folder paths for RoadRunner tests.
For variant models, use the VariantConfiguration
property to
specify the variant configuration to apply to the model before running the
test.
These properties have been added for RoadRunner test cases:
RoadRunnerInstallationFolder
RoadRunnerProjectFolder
RoadRunnerScenarioPath
RoadRunnerRunInConsoleMode
RoadRunnerTurnOffPacing
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)