Main Content

sltest.testmanager.TestIterationResult class

Package: sltest.testmanager

Access test iteration result data

Description

Instances of sltest.testmanager.TestIterationResult enable you to access the results from test execution performed by the Test Manager at a test-iteration level. The hierarchy of test results is Result Set > Test File Result > Test Suite Result > Test Case Result > Test Iteration Result.

The sltest.testmanager.TestIterationResult class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

The function sltest.testmanager.run creates a sltest.testmanager.ResultSet object, which contains the test case result object. For an example, see Get Test Iteration Results

Properties

expand all

The outcome of an individual test iteration result. The integer 0 means the test iteration was disabled, 1 means the test iteration execution was incomplete, 2 means the test iteration passed, and 3 means the test iteration failed.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: integer

Test iteration name, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Path of the input data file, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

The path of the test file used to create the test iteration result, returned as a character vector.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

The hierarchy path in the parent result set.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

The type of test case from the three available test cases in the Test Manager: simulation, baseline, and equivalence.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

Indicates if the simulation ran on the target or not, returned as an array of Booleans.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: logical

Time the test iteration began to run, returned as a datetime.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: datetime

Time the test completed, returned as a datetime.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: datetime

Length of time the test iteration ran, in seconds, returned as a duration.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: duration

Requirements associated with the test iteration, returned as an array of strings.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Error messages produced by the iteration, returned as a array of strings.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: string

Log messages produced by the iteration, returned as a array of strings.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: string

Cause of the test iteration failure, returned as an array of strings.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Description text for why the test iteration was disabled, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Name of the baseline file used in the test iteration, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Name of external input file, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Test iteration parameters that can override model parameters, returned as a struct containing the name of the sltest.testmanager.ParameterSet object, path to the object, and a structure that lists the parameter overrides.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Name of signal builder group or signal editor scenario used in the test iteration, returned as a string.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Test sequence scenario used in the test iteration, returned as a struct. The struct contains two fields, TestSequenceBlock and TestSequenceScenario. The TestSequenceBlock field is the path of the Test Sequence block containing the scenario that ran for this iteration. The TestSequenceScenario is the name of that scenario. The test sequence information is returned in a TestIterationResult object only if the test case included iterations. If iterations were not included, the TestSequenceScenario is returned in a TestCaseResults object.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: struct

Metadata of the simulation, returned as a Simulink.SimulationMetadata object.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Release in which the test was run, returned as a character vector.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Description of the test iteration, returned as a character vector.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Test coverage results, returned as a character array.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Tags to filter the test file results. Use tags to view a subset of the test results. See Tags for more information.

Attributes:

SetAccess
private
GetAccess
public
Dependent
true
NonCopyable
true

Parent of the test iteration result, returned as a TestCaseResult object.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: sltest.testmanager.TestCaseResult

Custom data stored with the test iteration results, specified as any type of data. Use this field to add custom information, such as the settings used to obtain the results.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Methods

expand all

Examples

collapse all

Open the model for this example.

sldemo_absbrake

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

tf = sltest.testmanager.TestFile('Get Test Iteration Results File');
ts = createTestSuite(tf,'Test Suite');
tc = createTestCase(ts,'baseline','Test Case');

Remove the default test suite.

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

Assign the system under test to the test case.

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

Specify the parameter values for each iteration. Then run a for loop that creates a test iteration object for each iteration, sets the parameter value and adds the iteration object to the test case structure.

vars = 32:0.5:34;

for k = 1:length(vars)

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

    % Set the parameter value for this iteration
    setVariable(testItr,'Name','g','Source',...
       'base workspace','Value',vars(k));

    str = sprintf('Iteration %d',k);

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

Run the test and capture the results.

resultset = run(tf);
tfr = getTestFileResults(resultset);
tsr = getTestSuiteResults(tfr);
tcr = getTestCaseResults(tsr);
tir = getIterationResults(tcr);

Get the test case type from first iteration.

testType = tir(1).TestCaseType;

Clean up Test Manager.

sltest.testmanager.clear
sltest.testmanager.clearResults
sltest.testmanager.close

Version History

Introduced in R2016a