sltest.testmanager.TestResultReport class

Package: sltest.testmanager
Superclasses:

Customize generated results report

Description

sltest.testmanager.TestResultReport is a class that enables you to customize report generation of result from the Test Manager. You can derive the class and override various methods to customize your report. By customizing the methods, you can change the report title, plots, tables, headers, icons, and more.

For more information and examples on customizing reports, see Customize Test Results Reports.

Construction

Obj = sltest.testmanager.TestResultReport(resultObjects,reportFilePath) creates a report generation object.

To use this class, you must inherit from the class. Use the following code as the first lines in your class definition code to inherit from the class.

% class definition
classdef CustomReport < sltest.testmanager.TestResultReport
    %
    % Report customization code here
    %
end

Input Arguments

expand all

Results set object to get results from, specified as an sltest.testmanager.ResultSet object.

File name and path of the generated report. File path must have file extension of pdf, docx, or zip, which are the only supported file types.

Example: 'C:\MATLAB\Report.pdf'

Properties

expand all

The name of the author or the generated report, specified as a character vector.

Example: 'Test Engineer'

Body paragraph text font color, specified as a character vector.

Example: 'Red'

Body paragraph text font-style name, specified as a character vector.

Example: 'Times New Roman'

Body paragraph text font size, specified in points as a character vector.

Example: '14pt'

First level section indentation width, specified in millimeters as a character vector.

Example: '5mm'

Second level section indentation width, specified in millimeters as a character vector.

Example: '8mm'

Third level section indentation width, specified in millimeters as a character vector.

Example: '10mm'

The file name and path to a Microsoft® Word template file for report customization, specified as a character vector. For more information about using template files, see Generate Reports Using Templates. The use of this argument is valid only available if you have a MATLAB® Report Generator™ license.

Example: 'C:\MATLAB\CustomReportTemplate.dotx'

Section heading text font color, specified as a character vector.

Example: 'Blue'

Section heading text font-style name, specified as a character vector.

Example: 'Times New Roman'

Section heading text font color, specified in points as a character vector.

Example: '16pt'

File name and path of an icon image for a disabled test result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\disabled_test_icon.png'

File name and path of an icon image for a failed test result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\failed_test_icon.png'

File name and path of an icon image for an incomplete test result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\incomplete_test_icon.png'

File name and path of an icon image for a misaligned test result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\misaligned_test_icon.png'

File name and path of an icon image for a passed test result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\passed_test_icon.png'

File name and path of an icon image for a test case result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\test_case_result_icon.png'

File name and path of an icon image for a test file result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\test_file_result_icon.png'

File name and path of an icon image for an iteration result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\iteration_result_icon.png'

File name and path of an icon image for a test suite result, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\test_suite_result_icon.png'

File name and path of an icon image for a model reference in the coverage report, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\model_reference_icon.png'

File name and path of an icon image for a top-level model in the coverage report, specified as a character vector. The icon file specified replaces the default icon image. The icon image is reduced to 16x16 pixels.

Example: 'C:\MATLAB\top_level_model_icon.png'

Include the signal comparison plots in the report, specified as true or false.

Include the coverage results in the report, specified as true or false.

Include error messages in the report, specified as true or false.

Include the version of MATLAB used to run the tests in the report, specified as true or false.

Include simulation metadata in the report, specified as true or false. The metadata includes: Simulink® version, model version, model author, date, model user ID, model path, machine name, solver name, solver type, fixed step size, simulation start time, simulation stop time, and platform.

Include the simulation signal output plots in the report, specified as true or false.

Include the test requirements linked to the test file, test suite, or test case in the report, specified as true or false.

Include all or a subset of test results in the report. You can select all passed and failed results, specified as the value 0, select only passed results, specified as the value 1, or select only failed results, specified as the value 2.

Open the report when it is finished generating, specified as a boolean value, true or to not open the report, false.

Title of the report, specified as a character vector

Example: 'Test Case Report'

Spacing between sections, specified in millimeters as a character vector.

Example: '5mm'

Plot height, specified in pixels as a character vector.

Example: '500px'

Plot width, specified in pixels as a character vector.

Example: '400px'

Table font color, specified as a character vector.

Example: 'Blue'

Table font-style name, specified as a character vector.

Example: 'Times New Roman'

Table font size, specified in points as a character vector.

Example: '10pt'

Title font color, specified as a character vector.

Example: 'Blue'

Title font-style name, specified as a character vector.

Example: 'Times New Roman'

Title font size, specified in points as a character vector.

Example: '20pt'

Methods

addReportBodyAdd main report body
addReportTOCAdd report table of contents
addTitlePageAdd report title page
genBaselineInfoTableGenerate baseline dataset information table
genCoverageTableGenerate coverage collection table
genHyperLinkToToCGenerate link to table of contents
genIterationSettingTableGenerate iteration settings table
genMetadataBlockForTestResultGenerate result metadata section
genParameterOverridesTableGenerate test case parameter overrides table
genRequirementLinksTableGenerate requirement links table
genResultSetBlockGenerate results set section
genRunBlockForTestCaseResultGenerate test case configuration and results section
genSignalSummaryTableGenerate signal output and comparison data
genSimulationConfigurationTableGenerate test case simulation configuration table
genTableRowsForResultMetaInfoGenerate test result metadata table
genTestCaseResultBlockGenerate test case result section
genTestSuiteResultBlockGenerate test suite result section
layoutReportIncorporates parts of report into one document
plotOneSignalToFileSave signal plot to file

Examples

collapse all

% class definition
classdef CustomReport < sltest.testmanager.TestResultReport
    % This custom class used by Test Manager 
    % adds a custom message in the title page

    % Class constructor
    methods
        function this = CustomReport(resultObjects, reportFilePath)
            this@sltest.testmanager.TestResultReport...
               (resultObjects,reportFilePath);
        end
    end

    methods(Access=protected)
        function addTitlePage(obj)
            import mlreportgen.dom.*;

            % Call the superclass method to get the default behavior
            addTitlePage@sltest.testmanager.TestResultReport(obj);

            % Add a custom message
            label = Text('Some custom content can be added here');
            append(obj.TitlePart,label);
        end
    end
end
% import existing results or use sltest.testmanager.run to run tests
% and collect results
result = sltest.testmanager.importResults('testResults.mldatx');
filePath = 'testreport.zip';
sltest.testmanager.report(result,filePath,...
			'Author','User',...
			'Title','Test',...
			'IncludeMLVersion',true,...
			'IncludeTestResults',int32(0),...
			'CustomReportClass','CustomReport',...
			'LaunchReport',true);
Introduced in R2016a