sltest.testmanager.TestFile class

Package: sltest.testmanager
Superclasses:

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.

Construction

obj = sltest.testmanager.TestFile(filePath,mode) creates a sltest.testmanager.TestFile object with a default test suite and test case as children of the test file. The default test case type is a baseline test case. If the test file exists on the path, a new test file is not created.

Input Arguments

expand all

The file name and path of the test file, specified as a character vector. The file can be a test file (.mldatx), or a MATLAB script test file (.m), if that script file is a derived class from sltest.TestCase. The specified file name determines the name of the test file as seen in the Test Manager.

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

Indicate if you want to override a test file with the same file name and path, specified as either true or false.

Properties

expand all

Test file description text, specified as a character vector.

Indicates if the test file has unsaved changes, 0 if there are no unsaved changes, and 1 if there are unsaved changes.

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

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

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

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

This property is read-only.

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

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.

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

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

Methods

closeClose test file in Test Manager
convertTestTypeConvert test from one type to another
createTestForSubsystem(To be removed) Create test harness and test case for subsystem in test file
createTestSuiteCreate new test suite
getCoverageSettingsGet coverage settings
getOptionsGet and set test file options
getPropertyGet test file property
getTestCaseByNameGet test case object by name
getTestCasesGet test cases in a test file
getTestSuiteByNameGet test suite object by name
getTestSuitesGet test suites at first level of test file
runRun test cases in test file
saveToFileSave test file
setPropertySet test file property

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