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.
MathWorks Products https://www.mathworks.com
- MATLAB R2019b or newer
- 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!
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
- 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.
Run MATLAB scripts from specified folders, for e.g. "doc" and "examples" and generate a test report
obj = examplesTester(["examples", "doc"]);
obj.executeTests;
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.executeTests;
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.executeTests;
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.executeTests;
The license is available in the LICENSE.txt file within this repository
Copyright 2023 The MathWorks, Inc.