Generate report of test specifications
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.
Generate a PDF report that uses the default template. This example
reports on test cases from the test manager 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.
testmgrFile = fullfile(matlabroot, ... 'toolbox', 'simulinktest', 'simulinktestdemos', ... 'AutopilotTestFile.mldatx'); sltest.testmanager.load(testmgrFile); tfiles = sltest.testmanager.getTestFiles; tcases = tfiles.getTestSuites.getTestCases; sltest.testmanager.TestSpecReport(tcases,'testReport.pdf',... 'Author','Test File Author',... 'Title','Test Specification Details',... 'IncludeCustomCriteria',false,... 'LaunchReport',true);
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 a Simulink® Report Generator™ license. See Templates (MATLAB Report Generator) for more information.
sltest.testmanager.TestCaseReporter.createTemplate(... 'MyCustomTemplate','pdf'); unzipTemplate('MyCustomTemplate.pdftx'); % Then, edit the template files in the % MyCustomTemplate folder as desired. zipTemplate('MyCustomTemplate.pdftx') testmgrFile = fullfile(matlabroot, ... 'toolbox', 'simulinktest', 'simulinktestdemos', ... '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');
testObj
— Test objects sltest.testmanager.TestFile
objects | array of sltest.testmanager.TestSuite
objects | array of sltest.testmanager.TestCase
objectsTest 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
— File name and path of the reportFile name 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 report
docx
— Word report
zip
— HTML report in a .zip file
Example: "reports/test_specs/new_report.pdf"
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'IncludeCallbackScripts',false
'Author'
— Report authorName of the report author, specified as a string or character vector.
Example: 'Author','J. Smith'
'Title'
— Report title'Test Specification Report'
(default) | string | character vectorTitle of the report, specified as a character vector.
'IncludeTest Details'
— Include test detailstrue
(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 optionstrue
(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 file name
Custom report class
'IncludeCoverageSettings'
— Include coverage settingstrue
(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 file name, 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 testtrue
(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 overridestrue
(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 scriptstrue
(default) | false
Option to include callback scripts in the report, specified as a logical.
'IncludeParameterOverrides'
— Include parameter overridestrue
(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, and the model
element.
'IncludeExternalInputs'
— Include external inputstrue
(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 signalstrue
(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 criteriatrue
(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 criteriatrue
(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 iterationstrue
(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, and logged signal set for each iteration. It also
includes the content of the Iterations Script section from the
Test Manager.
'IncludeCustomCriteria'
— Include custom criteriatrue
(default) | false
Option to include the custom pass/fail criteria script in the report, specified as a logical.
'LaunchReport'
— Open generated reportfalse
(default) | true
Option to open the report after it is generated, specified as a logical.
'TestCaseReporterTemplate'
— Path to test case reporter templatecharacter vector
Path to test case reporter template, specified as a character vector. The template
path file name 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 templatecharacter vector
Path to test suite reporter template, specified as a character vector. The file
name 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.
sltest.testmanager.getTestFiles
| sltest.testmanager.TestCase
| sltest.testmanager.TestFile
| sltest.testmanager.TestSuite
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.
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: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.