Documentation

Export Test Results and Generate Reports

Once you have run test cases and generated test results, you can export results and generate reports. Test case results appear in the Results and Artifacts pane.

Export Results

Test results are saved separately from the test file. To save results, select the result in the Results and Artifacts pane, and click Export on the toolstrip.

  • Select complete result sets to export to a MATLAB® data export file (.mldatx).

  • Select criteria comparisons or simulation output to export signal data to the base workspace or to a MAT-file.

Create a Test Results Report

Result reports contain report overview information, the test environment, results summaries with test outcomes, comparison criteria plots, and simulation output plots. You can customize the information included in the report, and you can save the report in three different file formats: ZIP (HTML), DOCX, and PDF.

  1. In the Results and Artifacts pane, select results for a test file, test suite, or test case.

    Note

    You can create a report from multiple result sets, but you cannot create a report from multiple test files, test suites, or test cases within results sets.

  2. From the toolstrip, click Report.

  3. Select the options to specify report contents.

  4. Set File Format to the output format you want.

  5. Click Create.

Save Reporting Options with a Test File

You can generate a report every time you run a test case in a test file, using the same report settings each time. To generate a report each time you run the test, set options under Test File Options. These settings are saved with the test file.

  1. In the Test Browser pane, select the test file whose report options you want to set.

  2. Under Test File Options, select Generate report after execution. The section expands, displaying the same report options you can set using the dialog box.

  3. Set the options. To include figures generated by callbacks or custom criteria, select MATLAB figures. For more information, see Create, Store, and Open MATLAB Figures.

  4. Store the settings with your test file. Save the test file.

  5. If you want to generate a report using these settings, select the test file and run the test.

Generate Reports Using Templates

Microsoft Word Format

If you have a MATLAB Report Generator™ license, you can create reports from a Microsoft® Word template. The report can be a Microsoft Word or PDF document.

The report generator in Simulink® Test™ fills information into rich text content controls in your Microsoft Word template document. For more information on how to use rich text content controls or customize part templates, see the MATLAB Report Generator documentation, such as Add Holes in a Microsoft Word Template (MATLAB Report Generator).

For a sample template, go to the path:

cd(matlabroot);
cd('help\toolbox\sltest\examples');
In the examples folder, open the file Template.dotx.

In the Microsoft Word template, you can add rich text content controls. Each Simulink Test report section can be inserted into the rich text content controls. The control names are:

  • ChapterTitle — report title

  • ChapterTestPlatform — version of MATLAB used to execute tests

  • ChapterTOC — test results table of contents

  • ChapterBody — test results

For example, the chapter title rich text content control appears in the Microsoft Word template as:

To change the control name, right-click the rich text content control and select Properties. Specify the control name, ChapterTitle or other name, in the Title and Tag field.

To generate a report from the Test Manager using a Microsoft Word template:

  1. In the Test Manager, select the Results and Artifacts pane.

  2. Select results for a test file, test suite, or test case in the Results and Artifacts pane.

  3. From the toolstrip, click Report.

  4. Select the report options.

  5. Select DOCX or PDF for the File Format.

  6. Specify the full path and file name of your Microsoft Word template.

  7. Click Create.

PDF or HTML Formats

If you have a MATLAB Report Generator license, you can create reports from a PDF or HTML template, using a PDFTX or HTMTX file. To generate a report from the Test Manager using a PDF or HTML template:

  1. In the Test Manager, select the Results and Artifacts pane.

  2. Select results for a test file, test suite, or test case in the Results and Artifacts pane.

  3. From the toolstrip, click Report.

  4. Select the report options.

  5. Select ZIP or PDF for the File Format. Selecting ZIP generates an HTML report.

  6. Specify the full path and file name of your template. For PDF, use a PDFTX file. For HTML, use an HTMTX file. For more information on creating templates, see Create Report Templates (MATLAB Report Generator).

  7. Click Create.

Related Topics

Was this topic helpful?