sltest.testsequence.editStep
Edit test sequence step
Description
sltest.testsequence.editStep(
edits
the properties of an existing step specified by blockPath
,stepPath
,Name,Value
)stepPath
in
a Test Sequence block specified by blockPath
.
Changes to the properties are specified by Name,Value
.
Examples
Add and Edit a Test Step
This example adds a test step then edits the step actions of the new step.
Open the model and test harness.
open_system('sltestTestSequenceWhenExample') sltest.harness.open('sltestTestSequenceWhenExample/SimpleTracker',... 'SimpleTrackerHarness')
Add a test step named SquareAndVeryQuick
.
sltest.testsequence.addStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick')
Edit the step actions.
action = sprintf('mode = uint8(3);... \nout = square(et);\n%% New step action')
action = mode = uint8(3); out = square(et); % New step action
sltest.testsequence.editStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick','Action',action,'Description',... 'This step outputs a high-frequency square wave.')
Add two substeps to the new step.
sltest.testsequence.addStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick.Step1') sltest.testsequence.addStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick.Step2')
Change the parent step to a When decomposition.
sltest.testsequence.editStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick','IsWhenStep',true)
Add a When condition to the substep Step1
.
sltest.testsequence.editStep('SimpleTrackerHarness/Test Sequence',... 'Square.SquareAndVeryQuick.Step1','WhenCondition','a >= 1')
Input Arguments
blockPath
— Test Sequence block path or handle
string | character vector
Path to a Test Sequence block, including the block name, specified as a string or character vector. Instead of the block path, you can use a block handle.
Example: 'FanSpeedTestHarness/Test Sequence'
stepPath
— Test step name and hierarchy level
character vector
Path of the step in the Test Sequence block, specified as a character vector.
The path includes the step location in the Test Sequence hierarchy, using
.
to separate hierarchy levels. If the Test Sequence block is
using scenarios, add the scenario name that contains the step to the beginning of the
step path, for example,
Scenario_2.SystemHeatingTest.InitializeHeating
.
Example: 'SystemHeatingTest.InitializeHeating'
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: 'Action','out = square(et)','IsWhenStep',false,'Description','This
step produces a square wave.'
specifies a test step to produce
a square wave.
Name
— Test step name
character vector
The new name for the test step, specified as a character vector.
Example: 'Name','HoldOutput'
Action
— Test step action
character vector
The test step action programming. To add a line, create the
step actions using the sprintf
function and the
new line operator \n
.
Example: 'Action','out = square(et)'
IsWhenStep
— Specifies standard or When
decomposition step
false (default) | true
Specifies whether the step is a standard transition type or
a When
decomposition transition
Example: 'IsWhenStep',true
WhenCondition
— When decomposition step switch condition
character vector
Character vector specifying the condition that activates a When
decomposition
child step. This must be a valid logical expression for the When
step
to activate.
Example: 'WhenCondition','a >= 1'
Description
— Description for the test step
character vector
Test step description, specified as a character vector.
Example: 'Description','This step produces a high-frequency
square wave.'
Version History
Introduced in R2016a
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 (한국어)