%% Generating a Test Results Report
%
% Report test results for a baseline test. 
%%
% This example shows how to generate a test results report from the 
% test manager using a baseline test case. The model used for
% this example is |sltestTestManagerReportsExample|.

%% Load and run the test file
% Load and run the test file programmatically using the test manager.
% The test file contains a baseline test case that fails when it is
% run. The baseline criteria specified in the baseline test case
% does not match the model simulation, which makes the test case fail.
%
% Copyright 2015 The MathWorks, Inc.


exampleFile = 'sltestTestManagerReportsTestSuite.mldatx';
sltest.testmanager.load(exampleFile);
baselineObj = sltest.testmanager.run;

%% Generate the report
% Generate a report of the test case results using the results set object.
% The report is saved as a ZIP and shows all test results. 
% The report opens when it is completed.
%
sltest.testmanager.report(baselineObj,'baselineReport.zip',...
    'IncludeTestResults',0,'IncludeComparisonSignalPlots',true,...
    'IncludeSimulationSignalPlots',true,'NumPlotRowsPerPage',3);

%%
% View the report when it is finished generating. In the baselineReport.zip
% folder, open the report.html file. Notice that the overall
% baseline test case fails. The signals in baseline criteria do not match,
% which causes the test failure. You can view the signal
% comparison plots in the report to verify the failure.

%%
%
sltest.testmanager.clear;
sltest.testmanager.clearResults;
