Examples Driven Tester
Examples driven tester is a tool for users which uses MATLAB® scripts which are already present in toolbox to provide a preliminary "smoke test" of the toolbox functionality. It runs MATLAB scripts via the MATLAB Function-Based unit test framework and generates a test and code coverage report. This tool is intended for preliminary qualification or Smoke testing of toolboxes. It is recommended to add unit tests for exhaustive functional testing of your code.
https://www.mathworks.com
MathWorks Products- MATLAB R2019b or newer
Installation
- Launch MATLAB and download Examples driven tester from Add-On Explorer in MATLAB
- Examples driven tester will be downloaded and should be ready to use!
Usage
obj = examplesTester(testFiles);
obj = examplesTester(testFiles, Name, Value)
testFiles
- Can have 2 possible values:
- An array of folders containing M files
- A path to json file which contains list of folders containing M files
Name Value pairs
- CreateTestReport - Should test report be generated. Possible values:[true], false
- TestReportFormat - Format of test report. Possible values: "pdf", "docx" , ["html”], “xml”
- OutputPath - Directory where reports will be generated. Default is pwd.
- CodeCoveragePlugin - MATLAB Code Coverage plugin.
Note: Values enclosed in square braces are default values.
Basic workflows
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a test report
obj = examplesTester(["examples", "doc"]);
obj.executesTests;
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" but do not generate a test report
obj = examplesTester(["examples", "doc"], CreateTestReport = false);
obj.executesTests;
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a test report in PDF format.
obj = examplesTester(["examples", "doc"], TestReportFormat = "PDF");
obj.executesTests;
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a code coverage report for code placed in "code" folder.
reportFormat = matlab.unittest.plugins.codecoverage.CoverageReport('coverage-report');
covPlugin = matlab.unittest.plugins.CodeCoveragePlugin.forFolder("code", "Producing", reportFormat);
obj = examplesTester(["examples", "doc"], CodeCoveragePlugin = covPlugin);
obj.executesTests;
License
The license is available in the LICENSE.txt file within this repository
Community Support
Copyright 2023 The MathWorks, Inc.