Main Content

sltest.testmanager.TestFile class

Package: sltest.testmanager

Create or modify test file

Description

Instances of sltest.testmanager.TestFile are files that can contain test suites and test cases.

For MATLAB®-based Simulink® tests, test files correspond to the file name. See Test Models Using MATLAB-Based Simulink Tests for more information.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

example

obj = sltest.testmanager.TestFile(filePath) opens the sltest.testmanager.TestFile that exists with the same file name and at the specified FilePath location. If the test file does not exist at the location, a new one is created with a default test suite and test case as children of the test file. The default test case type is a baseline test case.

obj = sltest.testmanager.TestFile(filePath,mode) overwrites the existing test file if mode is set to true. The default for mode is false.

Properties

expand all

File path and name of the test file, returned as a character vector.

Example: 'C:\MATLAB\test_file.mldatx'

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

Test file description text, specified as a character vector.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: char

Indicates if the test file has unsaved changes, returned as 0 or 1. If the value is 0, there are no unsaved changes. The value is 1 if there are unsaved changes.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: logical

Indicates if test cases that are children of the test file will execute, specified as a logical value true or false.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Data Types: logical

Name of the test file without the file path and file extension, returned as a character vector.

Attributes:

GetAccess
public
SetAccess
private
Dependent
true
NonCopyable
true

Data Types: char

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

The 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

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

Methods

expand all

Examples

collapse all

Create a new test file and return the test file object.

testfile = sltest.testmanager.TestFile('C:\MATLAB\test_file.mldatx')
testfile = 

  TestFile with properties:

            Name: 'test_file'
        FilePath: 'C:\MATLAB\test_file.mldatx'
           Dirty: 1
    Requirements: [0x1 struct]
     Description: ''
         Enabled: 1
Introduced in R2015b