sltest.testmanager.TestSpecReport
Generate report of test specifications
Description
sltest.testmanager.TestSpecReport(
generates a report of the test specifications for the specified testObj
,filePath
,Name,Value
)testObj
and saves the report to the specified filePath
location.
Examples
Generate a Test Specification Report
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;
Generate a Customized Test Specification Report
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
testObj
— Test objects
array of sltest.testmanager.TestFile
objects | array of sltest.testmanager.TestSuite
objects | array of sltest.testmanager.TestCase
objects
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.
filePath
— Filename and path of the report
character vector
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
Author
— Report author
empty string or character vector (default)
Name of the report author, specified as a string or character vector.
Example: 'Author','J. Smith'
Title
— Report title
'Test Specification Report'
(default) | string | character vector
Title of the report, specified as a character vector.
IncludeTestDetails
— Include test details
true
(default) | false
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.
IncludeTestFileOptions
— Include test file options
true
(default) | false
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
IncludeCoverageSettings
— Include coverage settings
true
(default) | false
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.
IncludeSystemUnderTest
— Include system under test
true
(default) | false
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
IncludeConfigSettingsOverrides
— Include configuration settings overrides
true
(default) | false
Option to include configuration settings overrides, specified as a logical. If
true
, the report includes the settings that differ from the model
configuration settings.
IncludeCallbackScripts
— Include callback scripts
true
(default) | false
Option to include callback scripts in the report, specified as a logical.
IncludeParameterOverrides
— Include parameter overrides
true
(default) | false
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.
IncludeExternalInputs
— Include external inputs
true
(default) | false
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.
IncludeLoggedSignals
— Include logged signals
true
(default) | false
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.
IncludeBaselineCriteria
— Include baseline criteria
true
(default) | false
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.
IncludeEquivalenceCriteria
— Include equivalence criteria
true
(default) | false
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.
IncludeIterations
— Include iterations
true
(default) | false
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.
IncludeLogicalAndTemporalAssessments
— Include logical and temporal assessments
true
(default) | false
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.
IncludeCustomCriteria
— Include custom criteria
true
(default) | false
Option to include the custom pass/fail criteria script in the report, specified as a logical.
LaunchReport
— Open generated report
false
(default) | true
Option to open the report after it is generated, specified as a logical.
TestCaseReporterTemplate
— Path to test case reporter template
character vector
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.
TestSuiteReporterTemplate
— Path to test suite reporter template
character vector
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.
Version History
Introduced in R2019b
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)