sltest.testmanager.TestCase - Create or modify test case - MATLAB (original) (raw)

Namespace: 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 setProperty and getProperty methods.

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

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

Creation

Description

`obj` = sltest.testmanager.TestCase(`parent`,`testtype`,`name`) creates a sltest.testmanager.TestCase object as a child of the specified Parent. TheTestType 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 specifiedTestType and test case Name.

example

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

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 valuetrue or 1, or false or0.

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

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

Use the addFaultSet method to create a fault set and a sltest.testmanager.FaultSet object for a test case. Retrieve existing fault sets in a test case by using the getFaultSets method. Use fault sets to specify the active Simulink Fault Analyzer™ faults in test cases.

You must have Simulink Fault Analyzer to use these methods.