Main Content

getSetupPlots

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

Plots from setup callbacks

Syntax

figs = getSetupPlots(result)

Description

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

Output Arguments

expand all

Figures from test suite 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('Test Suite 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 suite setup callback
setProperty(ts,'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);
tsr = getTestSuiteResults(tfr);

% Get the setup plot figure handles
figs = tsr.getSetupPlots;

Version History

Introduced in R2017a