Main Content

sltest.testmanager.TestCase class

Package: sltest.testmanager

Create or modify test case

Description

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.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

example

obj = sltest.testmanager.TestCase(parent,testtype,name) creates a sltest.testmanager.TestCase object as a child of the specified Parent. The TestType defaults to baseline and the test case is automatically assigned a default Name.

example

obj = sltest.testmanager.TestCase(parent,testtype,name) creates a sltest.testmanager.TestCase object with the specified TestType and test case Name.

Properties

expand all

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

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: sltest.testmanager.TestSuite

The 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.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

Name of the test case, specified as a character vector. If you do not specify a name, a unique name is created.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: char

Test case description text, returned as a character vector.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: char

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

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: logical

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.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: char

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

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: struct

Indicates if the test case simulation runs on a target, returned as a cell array of logical values. For more information on real-time testing, see Test Models in Real Time

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: logical

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

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: char | string

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

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: sltest.testmanager.TestFile

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

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

Methods

expand all

Examples

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: [1×1 sltest.testmanager.TestFile]
         TestPath: 'test_file > My Test Suite > Equivalence Test Case'
         TestType: 'equivalence'
      RunOnTarget: {2×1 cell}
    RunOnPlatform: {[Desktop]  [Desktop]}
           Parent: [1×1 sltest.testmanager.TestSuite]
     Requirements: [0×1 struct]
      Description: ''
          Enabled: 1
             Tags: [0×0 string]

Version History

Introduced in R2015b

expand all