generateHTMLReport
Class: matlab.unittest.TestResult
Namespace: matlab.unittest
Syntax
Description
generateHTMLReport(
generates a
multifile HTML test report from the test results and saves it to a temporary folder. By
default, the method names the main file of the report results
)index.html
.
Use this method to generate an HTML test report once the test run is complete and the test results are available.
generateHTMLReport(
saves the report to the specified location:results
,fileOrFolder
)
If you specify a file, the method generates a single-file report and saves it as the specified file. In a single-file HTML test report, all the contents of the report, such as text and images, are included in a single HTML file. (since R2024a)
If you specify a folder, the method generates a multifile report and saves it to the specified folder.
generateHTMLReport(___,
specifies options using one or more name-value arguments in addition to any of the input
argument combinations in previous syntaxes. For example,
Name=Value
)generateHTMLReport(results,MainFile="main.html")
generates a multifile
test report whose main file is main.html
instead of
index.html
.
Input Arguments
Examples
Limitations
A test report generated by the
generateHTMLReport
method does not include the text output from the Command Window.
Tips
When you generate a test report from test results that are created by a default runner, the report includes diagnostics for failing events and messages logged at the
matlab.automation.Verbosity.Terse
level. To generate a test report that includes diagnostics for passing events or messages logged at different verbosity levels, first customize your test run by adding aDiagnosticsRecordingPlugin
instance to the runner. For example, run your tests and generate a test report that includes passing diagnostics and messages logged at all verbosity levels.import matlab.unittest.plugins.DiagnosticsRecordingPlugin import matlab.automation.Verbosity suite = testsuite("sampleTest"); runner = testrunner("minimal"); runner.addPlugin(DiagnosticsRecordingPlugin( ... IncludingPassingDiagnostics=true,LoggingLevel=Verbosity.Verbose)) results = run(runner,suite); generateHTMLReport(results)
To generate a test report without explicitly collecting the test results, customize your test run by adding a
TestReportPlugin
instance to the test runner.