Main Content

addIteration

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

Add test iteration to test case

Syntax

addIteration(tc,iter)
addIteration(___,name)

Description

addIteration(tc,iter) adds a test iteration to the test case. The Test Manager gives the iteration a unique name.

addIteration(___,name) adds a test iteration to the test case with a specified name, which must be unique.

Input Arguments

expand all

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

Test iteration that you want to add to the test case, specified as a sltest.testmanager.TestIteration object.

Test iteration name, specified as a character vector. The name must be unique with respect to other iterations in the test case. This is an optional argument.

Example: 'Test Iteration 5'

Examples

expand all

In this example, there must be parameter sets defined in the Parameter Overrides section of the test case. The iterations are generated during test execution. This section of script is in the Scripted Iterations section of the test case. It will execute only in the Scripted Iterations section.

% Define parameter sets for a test case and add this code in the

% Scripted iterations section of the test case
for k = 1 : length(sltest_parameterSets)

    % Create test iteration object    
    testItr = sltest.testmanager.TestIteration();

    % Use the parameter set in this iteration
    testItr.setTestParam('ParameterSet', sltest_parameterSets{k});
    
    str = sprintf('ParameterSet %d', k);

    % Add the iteration object to the test case
    addIteration(sltest_testCase, testItr, str);
end

Version History

Introduced in R2016a