setProperty
Class: sltest.testmanager.TestCase
Namespace: 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
''
(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
StopSimAtLastTimePoint
— Stop simulation at last input time point
false
or
0
(default) | true
or 1
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
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.
VariantConfiguration
— Name of variant configuration
string | 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 Executable for Different Variant Parameter Values Without Recompiling Code.
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
).
PlotSignalAfterSimulation
— Plot logged signals when simulation complete
false
or
0
(default) | true
or 1
Enable plotting the logged signals when the simulation is complete,
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.
RoadRunnerInstallationFolder
— RoadRunner application installation folder
string | character vector
RoadRunner application installation folder, specified as a string or character vector. This property applies only to RoadRunner test cases.
RoadRunnerProjectFolder
— RoadRunner project folder
string | character vector
RoadRunner project folder, specified as a string or character vector. This property applies only to RoadRunner test cases.
RoadRunnerScenarioPath
— Path to RoadRunner scenario file
string | character vector
Path to RoadRunner scenario file, specified as a string or character vector. This property applies only to RoadRunner test cases.
RoadRunnerRunInConsoleMode
— Option to run RoadRunner scenario in console mode
true
or
1
(default) | false
or 0
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.
RoadRunnerTurnOffPacing
— Option to set RoadRunner pacing
true
or
1
(default) | false
or 0
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.
StopOnFailure
— Option to stop execution of test case when iteration fails
false
or
0
(default) | true
or 1
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.
OverrideRoadRunnerDefaultSettings
— Option to override default RoadRunner settings
true
or
1
(default) | false
or 0
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.
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 R2015bR2024a: Control execution of RoadRunner test cases
Use the StopOnFailure
property to specify whether to stop the
execution of a RoadRunner test case when an iteration fails.
R2024a: Override model stop time
Use the StopSimAtLastTimePoint
property to stop simulation at
the last input time point instead of the model Stop
Time.
R2024a: Override RoadRunner default path settings
Use the OverrideRoadRunnerDefaultSettings
property to
override the default file and folder paths for RoadRunner tests.
R2024a: New property for variant configuration
For variant models, use the VariantConfiguration
property to
specify the variant configuration to apply to the model before running the
test.
R2023b: Set properties for RoadRunner test cases
These properties have been added for RoadRunner test cases:
RoadRunnerInstallationFolder
RoadRunnerProjectFolder
RoadRunnerScenarioPath
RoadRunnerRunInConsoleMode
RoadRunnerTurnOffPacing
R2023a: 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 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)