Main Content

getSetupPlots

Class: sltest.testmanager.TestFileResult
Package: sltest.testmanager

Get plots from setup callbacks

Syntax

figs = getSetupPlots(result)

Description

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.

Examples

expand all

% Open the model for this example
openExample('sldemo_absbrake');

% 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');
remove(tsDel);

% 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
setProperty(tc,'Model','sldemo_absbrake');

% 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