Main Content


Class: sltest.testmanager.TestFileResult
Namespace: sltest.testmanager

Get plots from cleanup callbacks


figs = getCleanupPlots(result)


figs = getCleanupPlots(result) returns figure handles of plots generated from the cleanup callbacks of the test file 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 file results to get cleanup plot figure handles from, specified as a sltest.testmanager.TestFileResult object.

Output Arguments

expand all

Figures from test file 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('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 file cleanup callback
setProperty(tf,'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);

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

Version History

Introduced in R2017a