Main Content


Class: sltest.testmanager.TestSuiteResult
Namespace: sltest.testmanager

Get plots from cleanup callbacks of test suite


figs = getCleanupPlots(result)


figs = getCleanupPlots(result) returns figure handles of plots from the cleanup callbacks of the test suite associated with the results. Figures returned using this method are not visible. To see the plots, set the figure handle Visible property to 'on'.

Input Arguments

expand all

Test suite results to get cleanup plot figure handles from, specified as an sltest.testmanager.TestSuiteResult object.

Output Arguments

expand all

Figures from test suite cleanup callbacks, returned as an array of figure handles.


expand all

% Open the model for this example

% Create the test file, suite, and case
tf = sltest.testmanager.TestFile('Test Suite Cleanup Plots');
ts = createTestSuite(tf,'Cleanup Plots Test Suite');
tc = createTestCase(ts,'baseline','Cleanup Plots Test Case');

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

% Create a plot in the test suite cleanup callback
setProperty(ts,'CleanupCallback','a = [1,2,3]; f = figure; plot(a);');

% Set option to save figures
opt = getOptions(tf);
opt.SaveFigures = true;

% Assign the system under test to the test case

% Run the test and capture results
resultset = run(tf);
tfr = getTestFileResults(resultset);
tsr = getTestSuiteResults(tfr);

% Get the cleanup plot figure handles
figs = tsr.getCleanupPlots;

Version History

Introduced in R2017a