Main Content

getIterations

Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager

Get test iterations that belong to test case

Syntax

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

Description

iterArray = getIterations(tc) returns one or more test iterations that belong to the test case.

Note

Because test cases do not store scripted iterations after simulation, getIterations returns only table iterations.

iterArray = getIterations(tc,iterName) returns 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.

load_system("sf_car")

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

tf = sltest.testmanager.TestFile("Iterations Test File");
ts = sltest.testmanager.TestSuite(tf,"Iterations Test Suite");
tc = createTestCase(ts,simulation="Simulation Iterations");

Remove default test suite and its test case.

tsDel = getTestSuiteByName(tf,"New Test Suite 1");
remove(tsDel);

Specify model as system under test.

setProperty(tc,Model="sf_car");

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

testItr1 = sltestiteration;
setTestParam(testItr1,SignalEditorScenario="Passing_Maneuver");
addIteration(tc,testItr1);

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

testItr2 = sltestiteration;
setTestParam(testItr2,SignalEditorScenario="Coasting");
addIteration(tc,testItr2);

Get the iterations.

iters = getIterations(tc);

Version History

Introduced in R2016a