Main Content

本页采用了机器翻译。点击此处可查看英文原文。

saveToFile

类: sltest.testmanager.TestFile
命名空间: sltest.testmanager

保存测试文件

语法

saveToFile(tf)
saveToFile(tf,filePath)

说明

saveToFile(tf) 将更改保存到测试文件。

saveToFile(tf,filePath) 将测试文件保存到指定的文件路径。

输入参数

全部展开

测试文件,指定为 sltest.testmanager.TestFile 对象。

保存测试文件的文件路径和名称,指定为字符向量。

示例: 'C:\MATLAB\New Test File.mldatx'

示例

全部展开

% 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');

版本历史记录

在 R2015b 中推出