sltest.testmanager.TestCaseResult - Access test case results data - MATLAB (original) (raw)

Namespace: sltest.testmanager
Superclasses: sltest.testmanager.TestIterationResult

Access test case results data

Description

An sltest.testmanager.TestCaseResult enables you to access results from executing test cases or test files.

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

Creation

`tcr` = getTestCaseResults(`ResultSet`) returns tcr a test case result from a ResultSet.

Properties

expand all

The total number of tests in an individual test case result, returned as an integer.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

The number of passed tests in an individual test case result, returned as an integer.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

The number of failed tests in an individual test case result, returned as an integer.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

The number of disabled tests in an individual test case result, returned as an integer.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

The number of incomplete tests in an individual test case result, returned as an integer.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Outcome of an individual test case result, returned as an enumerated value. Valid values are:

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Test case 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 case result.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

The hierarchy path in the parent result set.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Indicates if the simulation runs on a target, returned as a cell array of Booleans.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Time the test case completed, returned as a datetime.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Error messages produced by the test case, returned as a struct. The struct contains two fields, TestCase andSimulation. The TestCase field is a string array that contains the names of the test cases. TheSimulation field is a struct with two fields,simulationIndex and messages. Themessages field is a string array that contains the text of the error messages.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Log messages produced by the test case, returned as a struct. The struct contains two fields, TestCase andSimulation. The TestCase field is a string array that contains the names of the test cases. TheSimulation field is a struct with two fields,simulationIndex and messages. Themessages field is a string array that contains the text of the log messages.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Name of external input and external input file, returned as a struct.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Test case 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

Fault set information, returned as a struct. The structure has two fields:

If you do not have Simulink® Fault Analyzer™, this property is empty.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Name of Signal Editor scenario used in the test case, returned as a string.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Test sequence scenario used in the test case, returned as a struct. The struct contains two fields, TestSequenceBlock andTestSequenceScenario. TheTestSequenceBlock field is the path of the Test Sequence block that contains the scenario. TheTestSequenceScenario is the name of the scenario that ran during the test. The test sequence information is returned in theTestCaseResult object only if the test case did not include iterations. If iterations were included, theTestSequenceScenario is returned in aTestIterationResults object.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Since R2024a

Variant configuration applied to the model before running the test case, specified as a struct with Name,Description, and ControlVariables fields.

This property applies to models that have variant configurations created using Variant Manager for Simulink, and if the VariantConfiguration property is specified on the test case object.

For an example, see Run Tests for Variant Models Using Variant Configurations.

Example: "LinInterExpNoNoise"

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 case, 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 result. The parent of a test case result is a test suite result or result set object.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

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

Attributes:

SetAccess public
GetAccess public
Dependent true
NonCopyable true

RoadRunner settings used to produce the test case results, returned as a structure that contains these fields:

This property applies only to RoadRunner test cases.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Platform on which test case ran, returned as a string This property applies only to RoadRunner test cases.

Attributes:

SetAccess private
GetAccess public
Dependent true
NonCopyable true

Methods

Examples

collapse all

This example shows how to run a test file from the test manager and obtain a results set. In this example, the Outcome of the first test case is Failed because a model is not specified.

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

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

Run the test file and obtain the output results set.

resultset = sltest.testmanager.run;

Get the test file, test suite, and test case result objects.

tfr = getTestFileResults(resultset); tsr = getTestSuiteResults(tfr); tcr = getTestCaseResults(tsr);

Get the error messages corresponding to the test case.

msg = tcr.ErrorMessages; msg.Simulation.messages

ans = "No model specified. Test did not run."

View the Outcome field of the first test case.

ans = TestResultOutcomes enumeration

Failed

Version History

Introduced in R2015a

expand all

The VariantConfiguration property is a struct withName, Description, andControlVariables fields..

For variant models, the VariantConfiguration property contains the name of the variant configuration used in the test case.

These properties have been added for the RoadRunner test case: