Main Content


Class: sltest.testmanager.TestCaseResult
Package: sltest.testmanager

Get plots from test case custom criteria


figs = getCustomCriteriaPlots(result)


figs = getCustomCriteriaPlots(result) returns figure handles of plots generated from the custom criteria of the test case 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 case result to get custom criteria figure handles from, specified as a sltest.testmanager.TestCaseResult object.

Output Arguments

expand all

Figures from test case custom criteria, 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 Case Custom Criteria');
ts = createTestSuite(tf,'CC Test Suite');
tc = createTestCase(ts,'baseline','CC Test Case');

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

% Create a plot in custom criteria and enable custom criteria
tcCriteria = getCustomCriteria(tc);
tcCriteria.Callback = 'a = [1,2,3]; f= figure; plot(a);';
tcCriteria.Enabled = true;

% 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);
tcr = getTestCaseResults(tsr);

% Get the custom criteria plot figure handles
figs = tcr.getCustomCriteriaPlots;

Version History

Introduced in R2017a