Main Content

sltest.testmanager.TestSpecReport

Generate report of test specifications

Description

example

sltest.testmanager.TestSpecReport(testObj,filePath,Name,Value) generates a report of the test specifications for the specified testObj and saves the report to the specified filePath location.

Examples

collapse all

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');

Input Arguments

collapse all

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.

File 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"

Name-Value Pair Arguments

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.

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 file name

    • 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 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.

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, and the model element.

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, and logged signal set for each iteration. It also includes the content of the Iterations Script section from the Test Manager.

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 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.

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.

Introduced in R2019b