Main Content

sltest.testmanager.TestCase class

Package: sltest.testmanager

Create or modify test case


Instances of sltest.testmanager.TestCase are test case objects.

If you want to modify the test case settings that define how the test case executes, use the methods setProperty and getProperty.

For MATLAB®-based Simulink® tests, test methods defined in the class file correspond to test cases. See Test Models Using MATLAB-Based Simulink Tests for more information.


obj = sltest.testmanager.TestCase(parent,type,name) creates a sltest.testmanager.TestCase object as a child of the specified parent. You can specify the name of the test case and the test case type: baseline, equivalence, or simulation.

Input Arguments

expand all

Parent test suite for the test case to reside in, specified as an sltest.testmanager.TestSuite object.

Test case type, specified as 'baseline', 'equivalence', or 'simulation'.

  • Baseline tests compare outputs from a simulation to expected results stored as baseline data.

  • Equivalence tests compare the outputs from two different simulations. Simulations can run in different modes, such as normal simulation and software-in-the-loop.

  • Simulation tests run the system under test and capture simulation data. If the system under test contains blocks that verify simulation, such as Test Sequence and Test Assessment blocks, pass/fail results are reflected in the simulation test results.

Name of the test suite, specified as a character vector. If this is empty, a unique name is created.

Example: 'Test Case 5'

Specify if you want to run the test case simulation on a target, specified as a cell array of Booleans. This is an optional argument. For more information on real-time testing, see Test Models in Real Time.


expand all

Test case description text, specified as a character vector.

Indicates if the test case will execute, specified as a logical value true or false.

Name of the test case, returned as a character vector.

Test suite that is the parent of the specified test case, returned as an sltest.testmanager.TestSuite object.

Description text for why the test file was disabled, specified as a character vector. This property is visible only when the Enabled property is set to false.

This property is read-only.

Releases available for testing, returned as a string array. Add releases using sltest.testmanager.setpref.

The requirements that are attached at the test-file level, returned as a structure.

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

Tags to use for categorizing, specified as a character vector or string array.

The test case type, returned as a character vector. The test case type can be one of the three types: simulation, equivalence, or baseline.

Test file that is the parent of the test case, returned as an sltest.testmanager.TestFile object.

Test file, test suite, and test case hierarchy, returned as a character vector.


addBaselineCriteriaAdd baseline criteria to test case
addInputAdd input file to test case
addIterationAdd test iteration to test case
addLoggedSignalSetAdd logged signal set to a test case
addParameterSetAdd parameter set
captureBaselineCriteriaCapture baseline criteria and add to test case
captureEquivalenceCriteriaCapture equivalence criteria and add to test case
convertTestTypeConvert test from one type to another
copySimulationSettingsCopy simulation setting in equivalence test case
createInputDataFileCreate file as basis for test case input signal data
deleteIterationsDelete test iterations that belong to test case
getBaselineCriteriaGet baseline criteria
getCoverageSettingsGet coverage settings
getCustomCriteriaGet custom criteria that belong to test case
getEquivalenceCriteriaGet equivalence criteria from test case
getInputsGet test case inputs
getIterationsGet test iterations that belong to test case
getLoggedSignalSetsGet logged signal set from a test case
getOptionsGet test file options
getParameterSetsGet test case parameter sets
getPropertyGet test case property
getTestCaseResults Get test case results history
removeRemove test case
runRun test case
setPropertySet test case property


collapse all

% Create test file
testfile = sltest.testmanager.TestFile('C:\MATLAB\test_file.mldatx');

% Create test suite
testsuite = sltest.testmanager.TestSuite(testfile,'My Test Suite');

% Create test case
testcase = sltest.testmanager.TestCase(testsuite,'equivalence',...
				'Equivalence Test Case')
testcase = 

  TestCase with properties:

            Name: 'Equivalence Test Case'
        TestFile: [1x1 sltest.testmanager.TestFile]
        TestPath: 'test_file > My Test Suite > Equivalence Test Case'
        TestType: 'equivalence'
     RunOnTarget: {2x1 cell}
          Parent: [1x1 sltest.testmanager.TestSuite]
    Requirements: [0x1 struct]
     Description: ''
         Enabled: 1
Introduced in R2015b