sltest.testmanager.TestCaseResult Class
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
returns tcr
= getTestCaseResults(ResultSet
)tcr
a test case result from a ResultSet
.
Properties
NumTotalIterations
— Total number of tests
integer
The total number of tests in an individual test case result, returned as an integer.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
NumPassedIterations
— Number of passed tests
integer
The number of passed tests in an individual test case result, returned as an integer.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
NumFailedIterations
— Number of failed tests
integer
The number of failed tests in an individual test case result, returned as an integer.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
NumDisabledIterations
— Number of disabled tests
integer
The number of disabled tests in an individual test case result, returned as an integer.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
NumIncompleteIterations
— Number of incomplete tests
integer
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
— Outcome of test case result
enum
Outcome of an individual test case result, returned as an enumerated value. Valid values are:
Disabled
Failed
Incomplete
Passed
Running
Scheduled
Untested
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Name
— Test case name
string
Test case name, returned as a string.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TestDataPath
— Input data file path
string
Path of the input data file, returned as a string.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TestFilePath
— Test file path
character vector
The path of the test file used to create the test case result.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TestCasePath
— Result hierarchy path
character vector
The hierarchy path in the parent result set.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TestCaseType
— Type of test case
'Simulation'
| 'Baseline'
| 'Equivalence'
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 |
RunOnTarget
— Target indicator
cell array
Indicates if the simulation runs on a target, returned as a cell array of Booleans.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
StartTime
— Time the test case began to run
datetime
Time the test case began to run, returned as a datetime.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
StopTime
— Time the test case completed
datetime
Time the test case completed, returned as a datetime.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Duration
— Length of time the test case ran
duration
Length of time the test case ran, in seconds, returned as a duration.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Requirements
— Test case requirements
array of strings
Requirements associated with the test case, returned as an array of strings.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ErrorMessages
— Error messages
struct
Error messages produced by the test case, returned as a struct. The struct
contains two fields, TestCase
and
Simulation
. The TestCase
field is
a string array that contains the names of the test cases. The
Simulation
field is a struct with two fields,
simulationIndex
and messages
. The
messages
field is a string array that contains the
text of the error messages.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
LogMessages
— Log messages
struct
Log messages produced by the test case, returned as a struct. The struct
contains two fields, TestCase
and
Simulation
. The TestCase
field is
a string array that contains the names of the test cases. The
Simulation
field is a struct with two fields,
simulationIndex
and messages
. The
messages
field is a string array that contains the
text of the log messages.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
CauseOfFailure
— Cause of test case failure
array of strings
Cause of the test case failure, returned as an array of strings.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
DisablingReason
— Disabled description
string
Description text for why the test case was disabled, returned as a string.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Baseline
— Name of baseline file
string
Name of the baseline file used in the test case, returned as a string.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ExternalInput
— Name of external input and external input file
struct
Name of external input and external input file, returned as a struct.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ParameterSet
— Test case parameters
ParameterSet
object
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 |
FaultSet
— Fault set information
struct
Fault set information, returned as a struct. The structure has two fields:
FaultSetName
— The names of the fault set, returned as a character vector.SpecifiedFaults
— The enabled faults in the fault set, returned as a struct. Each element of this struct is a struct that contains three fields:ModelElement
— The model element path of the fault, returned as a character vector.FaultName
— The fault name, returned as a character vector.Trigger
— The fault trigger type, returned as a character vector.
For more information on these fault properties, see Specify Fault Properties (Simulink Fault Analyzer).
If you do not have Simulink® Fault Analyzer™, this property is empty.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
SignalEditorScenario
— Name of Signal Editor scenario
string
Name of Signal Editor scenario used in the test case, returned as a string.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TestSequenceScenario
— Test sequence scenario
struct
Test sequence scenario used in the test case, returned as a struct. The
struct contains two fields, TestSequenceBlock
and
TestSequenceScenario
. The
TestSequenceBlock
field is the path of the Test
Sequence block that contains the scenario. The
TestSequenceScenario
is the name of the scenario that
ran during the test. The test sequence information is returned in the
TestCaseResult
object only if the test case did not
include iterations. If iterations were included, the
TestSequenceScenario
is returned in a
TestIterationResults
object.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
VariantConfiguration
— Variant configuration used in test case
string | character vector
Since R2024a
Variant configuration applied to the model before running the test case, specified as a string or character vector.
This property applies to models that have variant configurations created
using Variant Manager for Simulink, and the VariantConfiguration
property
was specified on the test case object using the setProperty
method.
For an example, see Run Executable for Different Variant Parameter Values Without Recompiling Code.
Example: "LinInterExpNoNoise"
Attributes:
GetAccess | public |
SetAccess | private |
Dependent | true |
NonCopyable | true |
Data Types: char
| string
SimulationMetaData
— Metadata of the simulation
SimulationMetadata
object
Metadata of the simulation, returned as a Simulink.SimulationMetadata
object.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Release
— Release in which the test was run
character vector
Release in which the test was run, returned as a character vector.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Description
— Description of the test case
character vector
Description of the test case, returned as a character vector.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
CoverageResults
— Test coverage results
character array
Test coverage results, returned as a character array.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Tags
— Tags to filter test file results
string array
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
— Parent of the result object
object
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 |
UserData
— Custom data stored with test case results
any data type
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 |
RoadRunnerSetup
— RoadRunner settings
structure
RoadRunner settings used to produce the test case results, returned as a structure that contains these fields:
RoadRunnerProjectPath
— Path to RoadRunner projectRoadRunnerInstallationPath
— Path to RoadRunner applicationRoadRunnerScenarioPath
— Path to RoadRunner scenarioRunInConsoleMode
— Whether the scenario ran in console or graphical modeTurnOffPacing
— Whether the scenario ran with pacing turned off or on
This property applies only to RoadRunner test cases.
Attributes:
SetAccess | private |
GetAccess | public |
Dependent | true |
NonCopyable | true |
RunOnPlatform
— Platform on which test case ran
string
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
Public Methods
getAssessmentResults | Get logical and temporal assessment results for test case result |
getBaselineRun | Get test case baseline dataset |
getTestCase | Get test case that produced result |
getComparisonResult | Get test data comparison result |
getComparisonRun | Get test case signal comparison results |
getCoverageResults | Get coverage results |
getCustomCriteriaPlots | Get plots from test case custom criteria |
getCustomCriteriaResult | Get custom criteria results from test case result |
getIterationResults | Get iteration results |
getInputRuns | Get inputs from simulations captured with the test result |
getOutputRuns | Get test case simulation output results |
getSimulationPlots | Get plots from test case callbacks |
getVerifyRuns | Get test case verify statement |
getTimingInfo | Timing execution information for test case results |
Examples
Get Test Case Result From Results Set
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.
tcr(1).Outcome
ans = TestResultOutcomes enumeration Failed
Version History
Introduced in R2015aR2024a: New property for variant configuration
For variant models, the VariantConfiguration
property
contains the name of the variant configuration used in the test case.
R2023b: New RoadRunner test case result properties
These properties have been added for the RoadRunner test case:
RoadRunnerSetup
RunOnPlatform
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)