Main Content

Generating a Test Results Report

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.

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

Generate the report

You can generate the test results report programmatically or by using the Test Manager interface.

To generate the report programmatically:

Generate a report of the test case results using the results set object. The report is saved as a ZIP and shows all the 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.

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

To generate the report by using the Test Manager:

Double-click on the test file, sltestTestManagerReportsTestSuite.mlx, in the current folder to open it in the Test Manager.

In the left pane, select the test suite. Click Run.

In the left pane, select the test results. In the toolstrip, click Report.

Click Create. To customize the report, see Customize Test Results Reports.

Related Topics