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.
Creation
creates a report generation object.Obj
= sltest.testmanager.TestResultReport(resultObjects
,reportFilePath
)
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
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
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
genTableRowsForResultMetaInfo | Generate test result metadata table |
addReportBody | Add main report body |
addReportTOC | Add report table of contents |
addTitlePage | Add report title page |
genBaselineInfoTable | Generate baseline dataset information table |
genCoverageTable | Generate coverage collection table |
genHyperLinkToToC | Generate link to table of contents |
genIterationSettingTable | Generate iteration settings table |
genMetadataBlockForTestResult | Generate result metadata section |
genParameterOverridesTable | Generate test case parameter overrides table |
genRequirementLinksTable | Generate requirement links table |
genResultSetBlock | Generate results set section |
genRunBlockForTestCaseResult | Generate test case configuration and results section |
genSignalSummaryTable | Generate signal output and comparison data |
genSimulationConfigurationTable | Generate test case simulation configuration table |
genTableRowsForResultMetaInfo | Generate test result metadata table |
genTestCaseResultBlock | Generate test case result section |
genTestSuiteResultBlock | Generate test suite result section |
layoutReport | Incorporates parts of report into one document |
plotOneSignalToFile | Save signal plot to file |
Examples
% 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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)