Main Content

getIterations

Class: sltest.testmanager.TestCase
Package: sltest.testmanager

Get test iterations that belong to test case

Syntax

iterArray = getIterations(tc)
iterArray = getIterations(tc,iterName)

Description

iterArray = getIterations(tc) get one or more test iteration objects that belong to the test case.

Note

Because scripted iterations are discarded after simulation, test cases do not store the iterations and getIterations does not return them.

iterArray = getIterations(tc,iterName) get one or more test iteration objects with the specified name that belong to the test case.

Input Arguments

expand all

Test case that you want to get the iteration from, specified as a sltest.testmanager.TestCase object.

Test iteration name, specified as a character vector. This is an optional argument.

Example: 'Test Iteration 5'

Output Arguments

expand all

Test iterations that belong to the test case, returned as an array of sltest.testmanager.TestIteration objects.

Examples

expand all

Open the model for this example.

sldemo_autotrans

Create the test file, test suite, and test case structure.

tf = sltest.testmanager.TestFile('Iterations Test File');
ts = getTestSuites(tf);
tc = createTestCase(ts,'simulation','Simulation Iterations');

Specify model as system under test.

setProperty(tc,'Model','sldemo_autotrans');

Set up table iteration and create an iteration object. Set the iteration parameters and add the iteration to the test case.

testItr1 = sltestiteration;
setTestParam(testItr1,'SignalBuilderGroup','Passing Maneuver');
addIteration(tc,testItr1);

Set up another table iteration and create an iteration object. Set the iteration parameters and add the iteration to the test case.

testItr2 = sltestiteration;
setTestParam(testItr2,'SignalBuilderGroup','Coasting');
addIteration(tc,testItr2);

Get the iterations.

iters = getIterations(tc);

Version History

Introduced in R2016a