Main Content

run

Class: sltest.testmanager.TestFile
Package: sltest.testmanager

Run test cases in test file

Syntax

resultObj = run(tf)

Description

resultObj = run(tf) runs the enabled test cases in the test file and returns a results set object.

Input Arguments

expand all

Test file with the test cases you want to run, specified as an sltest.testmanager.TestFile object.

Output Arguments

expand all

Test results, returned as a results set object, sltest.testmanager.ResultSet.

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('My Test File');
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');

% Run the test file and return an object with results data
ro = run(tf);
Introduced in R2015b