Main Content


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

Get plots from setup callbacks


figs = getSetupPlots(result)


figs = getSetupPlots(result) returns figure handles of plots from the setup 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 setup plot figure handles from, specified as a sltest.testmanager.TestFileResult object

Output Arguments

expand all

Figures from test file setup 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('Get Test File Setup Plots');
ts = createTestSuite(tf,'Setup Plots Test Suite');
tc = createTestCase(ts,'baseline','Setup Plots Test Case');

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

% Create a plot in the test file setup callback
setProperty(tf,'SetupCallback','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 setup plot figure handles
figs = tfr.getSetupPlots;

Version History

Introduced in R2017a