Main Content

sltest.testsequence.editStep

Edit test sequence step

Description

sltest.testsequence.editStep(blockPath,stepPath,Name,Value) edits the properties of an existing step specified by stepPath in a Test Sequence block specified by blockPath. Changes to the properties are specified by Name,Value.

Examples

collapse all

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

collapse all

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'

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.

The new name for the test step, specified as a character vector.

Example: 'Name','HoldOutput'

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)'

Specifies whether the step is a standard transition type or a When decomposition transition

Example: 'IsWhenStep',true

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'

Test step description, specified as a character vector.

Example: 'Description','This step produces a high-frequency square wave.'

Version History

Introduced in R2016a