sltest.testmanager.TestSpecReport
Generate report of test specifications
Syntax
Description
sltest.testmanager.TestSpecReport(___,
specifies options using one or more name-value arguments in addition to the input arguments
in previous syntaxes.Name=Value
)
Examples
Generate a PDF report that uses the default template. This example reports on test cases from the test file of the AutopilotTestFile
model. The report specifies the test author and report title. It excludes custom criteria from the report and launches the report after it is generated. Other properties default to true
and thus, their information is included in the report.
testfile = 'AutopilotTestFile.mldatx'; sltest.testmanager.load(testfile); tfile = sltest.testmanager.TestFile(testfile); tsuites = getTestSuites(tfile); tcases = getTestCases(tsuites); sltest.testmanager.TestSpecReport(tcases,'testReport.pdf',... 'Author','Test File Author',... 'Title','Test Specification Details',... 'IncludeCustomCriteria',false,... 'LaunchReport',true); sltest.testmanager.clear; sltest.testmanager.clearResults;
Create a custom test case template. After you edit the template as desired, use that template when generating the report. Examples of edits to the custom template include reordering the report sections and changing the report fonts. This example shows how to generate a customized TestCaseReporter. Generating a customized TestSuiteReporter template is similar and is used to generate both Test Suite and Test File report sections. Customizing templates requires MATLAB Report Generator and Simulink Report Generator licenses.
Create and Unzip the PDF Template File
sltest.testmanager.TestCaseReporter.createTemplate(... 'MyCustomTemplate','pdf'); unzipTemplate('MyCustomTemplate.pdftx');
Edit the Template Files
Then, edit the template files in the MyCustomTemplate folder as desired.
Zip the Template Files
zipTemplate('MyCustomTemplate.pdftx');
Use Your Custom Template File For a Report
testmgrFile = 'AutopilotTestFile.mldatx'; sltest.testmanager.load(testmgrFile); tfiles = sltest.testmanager.getTestFiles; tcases = tfiles.getTestSuites.getTestCases; sltest.testmanager.TestSpecReport(tcases,'testReport.pdf',... 'Author','Test Author','Title','Test',... 'LaunchReport',true,... 'TestCaseReporterTemplate','MyCustomTemplate.pdftx'); sltest.testmanager.clear; sltest.testmanager.clearResults;
Input Arguments
Test objects from which to generate the test specification report, specified as an
array of sltest.testmanager.TestFile
,
sltest.testmanager.TestSuite
, or
sltest.testmanager.TestCase
objects. You cannot include a different
object types in the same array.
Filename and path of the generated report, specified as a string or character array. The file path must have one of these file extensions:
pdf
— PDF reportdocx
— Word reportzip
— HTML report in a .zip file
Example: "reports/test_specs/new_report.pdf"
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'IncludeCallbackScripts',false
Name of the report author, specified as a string or character vector.
Example: 'Author','J. Smith'
Title of the report, specified as a character vector.
Option to include test details in the report, specified as a logical. If
true
, the test details included in the report are test tags,
releases, description, and requirements.
Option to include test file options in the report, specified as a logical. If
true
, the test file options included in the report are:
Whether to close open figures
Whether to store MATLAB figures
Whether to generate the report after execution
Results report generation options
Report title
Author
Whether to include the MATLAB version
Types of test results to include (all, failed only, or passed only)
Other items to include in the report - test requirements, simulation metadata, error and log messages, plots of simulation output and baseline, plots of criteria and assessments, MATLAB® figures, and coverage results
Output file format
Output filename
Custom report class
Option to include coverage settings in the report, specified as a logical. If
true
, the coverage settings included in the report are coverage
to collect, coverage filter filename, and coverage metrics. Examples of coverage
metrics included in the report include decisions, signal range, relational boundaries,
saturation on integer overflow, and lookup tables. For more information about
collecting coverage, see Collect Coverage in Tests.
Option to include the system under test in the report, specified as a logical. If
true
, the system under test information included in the report is:
Model name and image
Harness name and image
Test sequence and assessment data (if they exist in the test harness)
Simulation settings — simulation mode, start time (if overridden), stop time (if overridden), and initial state (if overridden)
Target settings — target information for real-time test cases
Option to include configuration settings overrides, specified as a logical. If
true
, the report includes the settings that differ from the model
configuration settings.
Option to include callback scripts in the report, specified as a logical.
Option to include parameter overrides in the report, specified as a logical. If
true
, the report includes the name of the parameter set or
workspace variable, the override value, the source of the variable, the model
element, and if used, the variant configuration.
Option to include external inputs in the report, specified as a logical. If
true
, the report includes the name, file path, and mapping status
of the external inputs.
Option to include logged signals, specified as a logical. If
true
, the report includes the name, source, port index, and plot
index for each logged signal.
Option to include baseline criteria information in the report, specified as a
logical. If true
, the report includes the signal name, absolute
tolerance, relative tolerance, leading tolerance, and lagging tolerance for the
baseline test.
Option to include equivalence criteria information in the report, specified as a
logical. If true
, the report includes the signal name, absolute
tolerance, relative tolerance, leading tolerance, and lagging tolerance for the
equivalence test.
Option to include iterations information in the report, specified as a logical. If
true
, the report includes the iteration name and the values of
the external inputs, parameter set, logged signal set, and variant configuration for
each iteration. It also includes the content of the Iterations
Script section from the Test Manager.
Option to include logical and temporal assessments in the report, specified as a
logical. If true
, the report includes the Assessment Callbacks,
Assessment Definitions, and Symbols from the Test Case.
Option to include the custom pass/fail criteria script in the report, specified as a logical.
Option to open the report after it is generated, specified as a logical.
Path to test case reporter template, specified as a character vector. The template
path filename must use a pdftx
, html
, or
dotx
extension, for a PDF, HTML, or Word template, respectively.
The specified template is used instead of the default
TestCaseReporter
template. Using non-default templates is
available only if you have a Simulink®
Report Generator™ license.
Path to test suite reporter template, specified as a character vector. The
filename in the template path must use a pdftx
,
html
, or dotx
extension, for a PDF, HTML, or
Word template, respectively. The TestSuiteReporter
template is
used for both test suites and test files. The specified template is used instead of
the default TestSuiteReporter
template. Using non-default
templates is available only if you have a Simulink
Report Generator license.
Since R2025a
Option to include sequence diagrams in the test specification report, specified as
true
or false
. Set this argument to
true
to include an image of the executed sequence diagram in the
report.
Version History
Introduced in R2019bUse the IncludeSequenceDiagrams
argument to specify whether to
include sequence diagrams in the test specification report.
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)