Main Content

addTitlePage

Class: sltest.testmanager.TestResultReport
Namespace: sltest.testmanager

Add report title page

Syntax

addTitlePage(obj)

Description

addTitlePage(obj) adds the title page to the report.

Input Arguments

expand all

Test report, specified as a sltest.testmanager.TestResultReport object.

Examples

expand all

This example shows how to customize the title page of a test results report by using a custom class.

View Custom Class CustomTitleReport

Open and review the custom class, CustomTitleReport. The CustomTitleReport class adds a custom label to the title page by modifying the addTitlePage method.

open CustomTitleReport.m
    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

Generate Report with Custom Title Page

Import the test results file into the Test Manager.

results = sltest.testmanager.importResults("testResults.mldatx");

Generate a report that includes all passed and failed results and uses the custom class.

sltest.testmanager.report(results,"CustomTitleReport.pdf", ...
    IncludeTestResults=0,Author="TestAuthor", ...
    CustomReportClass="CustomTitleReport");

The title page includes the custom label Some custom content can be added here

Version History

Introduced in R2016a