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
resultObjects
— Results set object
object
Results set object to get results from, specified as an sltest.testmanager.ResultSet
object.
reportFilePath
— Filename and path of the generated report
character vector
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
AuthorName
— Author name
empty character vector (default)
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
BodyFontColor
— Body paragraph font color
'Black'
(default) | character vector
Body paragraph text font color, specified as a character vector.
Example: 'Red'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
BodyFontName
— Body paragraph font style name
'Arial'
(default) | character vector
Body paragraph text font-style name, specified as a character vector.
Example: 'Times New Roman'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
BodyFontSize
— Body paragraph font size
'12pt'
(default) | character vector
Body paragraph text font size, specified in points as a character vector.
Example: '14pt'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ChapterIndent
— First level indentation width
'3mm'
(default) | character vector
First level section indentation width, specified in millimeters as a character vector.
Example: '5mm'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ChapterIndentL2
— Second level indentation width
'6mm'
(default) | character vector
Second level section indentation width, specified in millimeters as a character vector.
Example: '8mm'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
ChapterIndentL3
— Third level indentation width
'8mm'
(default) | character vector
Third level section indentation width, specified in millimeters as a character vector.
Example: '10mm'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
CustomTemplateFile
— Template filename and path
empty character vector (default)
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 |
HeadingFontColor
— Section heading font color
'Black'
(default) | character vector
Section heading text font color, specified as a character vector.
Example: 'Blue'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
HeadingFontName
— Section heading font style name
'Arial'
(default) | character vector
Section heading text font-style name, specified as a character vector.
Example: 'Times New Roman'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
HeadingFontSize
— Section heading font size
'14pt'
(default) | character vector
Section heading text font color, specified in points as a character vector.
Example: '16pt'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
IconFileOutcomeDisabled
— Disabled test result icon
empty character vector (default)
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 |
IconFileOutcomeFailed
— Failed test result icon
empty character vector (default)
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 |
IconFileOutcomeIncomplete
— Incomplete test result icon
empty character vector (default)
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 |
IconFileOutcomeMisaligned
— Misaligned test result icon
empty character vector (default)
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 |
IconFileOutcomePassed
— Passed test result icon
empty character vector (default)
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 |
IconFileTestCaseResult
— Test case result icon
empty character vector (default)
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 |
IconFileTestFileResult
— Test file result icon
empty character vector (default)
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 |
IconFileTestIterationResult
— Iteration result icon
empty character vector (default)
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 |
IconFileTestSuiteResult
— Test suite result icon
empty character vector (default)
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 |
IconModelReference
— Model reference icon
empty character vector (default)
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 |
IconTopLevelModel
— Top-level model icon
empty character vector (default)
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 |
IncludeComparisonSignalPlots
— Include comparison signal plots
false
(default) | true
Include the signal comparison plots in the report, specified as
true
or false
.
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
IncludeCoverageResult
— Include coverage results
false
(default) | true
Include the coverage results in the report, specified as
true
or false
.
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
IncludeErrorMessages
— Include error messages
true
(default) | false
Include error messages in the report, specified as true
or false
.
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
IncludeMWVersion
— Include MATLAB version
true
(default) | false
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 |
IncludeSimulationMetaData
— Include simulation metadata
false
(default) | 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 |
IncludeSimulationSignalPlots
— Include simulation signal plots
false
(default) | true
Include the simulation signal output plots in the report, specified as
true
or false
.
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
IncludeTestRequirement
— Include test requirement
true
(default) | false
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 |
IncludeTestResults
— Include all or subset of test results
2
(default) | 0
| 1
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 |
LaunchReport
— Open report at completion
true
(default) | false
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 |
ReportTitle
— Report title
empty character vector (default)
Title of the report, specified as a character vector
Example: 'Test Case Report'
Attributes:
SetAccess | public |
GetAccess | public |
Dependent | true |
NonCopyable | true |
SectionSpacing
— Spacing between sections
'2mm'
(default) | character vector
Spacing between sections, specified in millimeters as a character vector.
Example: '5mm'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
SignalPlotHeight
— Plot height
'600px'
(default) | character vector
Plot height, specified in pixels as a character vector.
Example: '500px'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
SignalPlotWidth
— Plot width
'500px'
(default) | character vector
Plot width, specified in pixels as a character vector.
Example: '400px'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TableFontColor
— Table font color
'Black'
(default) | character vector
Table font color, specified as a character vector.
Example: 'Blue'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TableFontName
— Table font style name
'Arial'
(default) | character vector
Table font-style name, specified as a character vector.
Example: 'Times New Roman'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TableFontSize
— Table font size
'7.5pt'
(default) | character vector
Table font size, specified in points as a character vector.
Example: '10pt'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TitleFontColor
— Title font color
'Black'
(default) | character vector
Title font color, specified as a character vector.
Example: 'Blue'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TitleFontName
— Title font style name
'Arial'
(default) | character vector
Title font-style name, specified as a character vector.
Example: 'Times New Roman'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
TitleFontSize
— Title font size
'16pt'
(default) | character vector
Title font size, specified in points as a character vector.
Example: '20pt'
Attributes:
SetAccess | protected |
GetAccess | public |
Dependent | true |
NonCopyable | true |
Methods
Public 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
Inherit Class and Customize a Report
% 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
Use Custom Report Class to Generate Report
% 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)