Main Content

sltest.testmanager.TestResultReport class

Package:sltest.testmanager

Customize generated results report

Description

sltest.testmanager.TestResultReportis 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, seeCustomize Test Results Reports.

Thesltest.testmanager.TestResultReportclass is ahandleclass.

Class Attributes

HandleCompatible
true

For information on class attributes, seeClass Attributes.

Creation

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

要使用这个类,必须继承自该类. Use the following code as the first lines in your class definition code to inherit from the class.

% class definitionclassdefCustomReport < sltest.testmanager.TestResultReport%% Report customization code here%end

Input Arguments

expand all

Results set object to get results from, specified as ansltest.testmanager.ResultSetobject.

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

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 file name and path to aMicrosoft®Wordtemplate file for report customization, specified as a character vector. For more information about using template files, seeGenerate Reports Using Templates. The use of this argument is valid only available if you have aMATLAB®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

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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:MATLAB的C: \ \ misaligned_test_icon.png'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

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'

Attributes:

SetAccess
protected
GetAccess
public
Dependent
true
NonCopyable
true

Include the signal comparison plots in the report, specified astrueorfalse.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Include the coverage results in the report, specified astrueorfalse.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

包括报告错误信息,指定为trueorfalse.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Include the version of MATLAB used to run the tests in the report, specified astrueorfalse.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Include simulation metadata in the report, specified astrueorfalse. 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.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Include the simulation signal output plots in the report, specified astrueorfalse.

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 astrueorfalse.

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 value0, select only passed results, specified as the value1, or select only failed results, specified as the value2.

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Open the report when it is finished generating, specified as a boolean value,trueor 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 definitionclassdefCustomReport < sltest.testmanager.TestResultReport% This custom class used by Test Manager% adds a custom message in the title page% Class constructormethodsfunctionthis = CustomReport(resultObjects, reportFilePath) this@sltest.testmanager.TestResultReport...(resultObjects,reportFilePath);endendmethods(Access=protected)functionaddTitlePage(obj) importmlreportgen.dom.*;% Call the superclass method to get the default behavioraddTitlePage@sltest.testmanager.TestResultReport(obj);% Add a custom messagelabel = Text('Some custom content can be added here'); append(obj.TitlePart,label);endendend
% import existing results or use sltest.testmanager.run to run tests% and collect resultsresult = 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