Documentation

sltest.testsequence.addStepAfter

Add test sequence step after existing step

Syntax

sltest.testsequence.addStepAfter(blockPath,newStep,stepPath,Name,Value)

Description

sltest.testsequence.addStepAfter(blockPath,newStep,stepPath,Name,Value) adds a step to a Test Sequence block specified by blockPath. The new step is named newStep and is inserted after stepPath. Step properties are specified by Name,Value.

Examples

collapse all

This example creates a test step, step1, in a Test Sequence block after the step SetLowPhi, which is in the second level of hierarchy under the top-level step APEngagement_AttitudeLevels.

  1. Set paths and open the model.

    filePath = fullfile(matlabroot,'toolbox','simulinktest','simulinktestdemos');
    rollModel = 'RollAutopilotMdlRef';
    testHarness = 'RollReference_Requirement1_3';
    open_system(fullfile(filePath,rollModel));
  2. Open the test harness.

    sltest.harness.open([rollModel '/Roll Reference'],testHarness)
  3. Create a new local variable h.

    sltest.testsequence.addSymbol('RollReference_Requirement1_3/Test Sequence',...
    'h','Data','Local');
  4. Add a step named step2 and set the value of h to 5.

    sltest.testsequence.addStepAfter('RollReference_Requirement1_3/Test Sequence',...
    'AttitudeLevels.APEngage_LowRoll.step2',...
    'AttitudeLevels.APEngage_LowRoll.SetLowPhi','Action','h = 5;')

Input Arguments

collapse all

Path to a Test Sequence block, including the block name, specified as a character vector.

Example: 'FanSpeedTestHarness/Test Sequence'

Name of a new test step in the Test Sequence block, specified as a character vector. It is added after stepPath and must have the same parent step as stepPath.

Example: 'newStep'

Example: 'topStep.midStep.newStep'

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.

Example: 'SystemHeatingTest.InitializeHeating'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Action','out = square(et)','IsWhenStep',false,'Description','This step produces a square wave.' specifies a test step to produce a square wave.

collapse all

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

Specifies the condition that activates a When decomposition child step. To activate the When step, enter a valid logical expression.

Example: 'WhenCondition','a >= 1'

Test step description, specified as a character vector.

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

Introduced in R2016a

Was this topic helpful?