Main Content

sltest.testmanager.TestResultReport Class

Namespace: sltest.testmanager

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.

The sltest.testmanager.TestResultReport class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

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.

Filename 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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Red'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Times New Roman'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '14pt'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '5mm'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '8mm'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '10mm'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

The filename 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'

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Blue'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Times New Roman'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '16pt'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Filename 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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Include simulation metadata in the report, specified as true or false. The metadata includes the Simulink® model, model version, model path, simulation mode, override SIL or PIL mode, configuration set, variant configuration, solver name and type, max step size, start and stop time, checksum, user id, machine name, platform, and Simulink version and release.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Title of the report, specified as a character vector

Example: 'Test Case Report'

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '5mm'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Plot height, specified in pixels as a character vector.

Example: '500px'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Plot width, specified in pixels as a character vector.

Example: '400px'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Table font color, specified as a character vector.

Example: 'Blue'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Times New Roman'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '10pt'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Title font color, specified as a character vector.

Example: 'Blue'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: 'Times New Roman'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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

Example: '20pt'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Methods

expand all

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);

Version History

Introduced in R2016a