Main Content

saveToFile

Class: sltest.testmanager.TestFile
Namespace: sltest.testmanager

Save test file

Syntax

saveToFile(tf)
saveToFile(tf,filePath)

Description

saveToFile(tf) saves the changes to the test file.

saveToFile(tf,filePath) saves the test file to the specified file path.

Input Arguments

expand all

Test file, specified as a sltest.testmanager.TestFile object.

The file path and name to save the test file at, specified as a character vector.

Example: 'C:\MATLAB\New Test File.mldatx'

Examples

expand all

% Open the model for this example
openExample('sldemo_autotrans');

% Create the test file, test suite, and test case structure
tf = sltest.testmanager.TestFile('C:\MATLAB\My Test File.mldatx');
ts = createTestSuite(tf,'My Test Suite');
tc = createTestCase(ts,'simulation','Simulation Test Case');

% Remove the default test suite
tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);

% Assign the system under test to the test case
setProperty(tc,'Model','sldemo_autotrans');

% Save the test file
saveToFile(tf);

% Save test file object as another test file
saveToFile(tf,'C:\MATLAB\New Test File.mldatx');

Version History

Introduced in R2015b