Skip to content

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.

License

Notifications You must be signed in to change notification settings

mathworks/ExamplesDrivenTester

Repository files navigation

Examples Driven Tester

View ExamplesDrivenTester on File Exchange

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

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:

  1. An array of folders containing M files
  2. 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.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;

License

The license is available in the LICENSE.txt file within this repository

Community Support

MATLAB Central

Copyright 2023 The MathWorks, Inc.

About

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.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages