Main Content


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

Get all test suites in test file

Since R2022b


tsArray = getAllTestSuites(tf)


tsArray = getAllTestSuites(tf) returns an array of the test suite objects in the test file.

Input Arguments

expand all

Test file that contains the test suites, specified as a sltest.testmanager.TestFile object.

Output Arguments

expand all

Test suites, returned as an array of sltest.testmanager.TestSuite objects.


expand all

Create a test file, which creates a default test suite and test case.

tf = sltest.testmanager.TestFile("My TestFile");

Add a test suite at the top level and another as its child.

ts_1 = sltest.testmanager.TestSuite(tf,"My TestSuite 1");
ts_1a = sltest.testmanager.TestSuite(ts_1,"TestSuite 1a");

Add another test suite at the top level and two test suites as its children.

ts_2 = sltest.testmanager.TestSuite(tf,"My TestSuite 2");
ts_2a = sltest.testmanager.TestSuite(ts_2,"TestSuite 2a");
ts_2b = sltest.testmanager.TestSuite(ts_2,"TestSuite 2b");

Obtain and display the names of all the test suites.

all_ts = getAllTestSuites(tf);
ans = 
'New Test Suite 1'
ans = 
'My TestSuite 1'
ans = 
'My TestSuite 2'
ans = 
'TestSuite 1a'
ans = 
'TestSuite 2a'
ans = 
'TestSuite 2b'

Version History

Introduced in R2022b