Package: matlab.unittest.plugins
Plugin that produces a code coverage report
To produce a line coverage report for MATLAB® source code, add the CodeCoveragePlugin
to the
TestRunner
. The testing framework runs the tests, and the resulting
coverage report indicates the executed lines of code. The coverage report is based on
source code located in one or more folders or packages. The source code must be on the
MATLAB path and remain on the path during the test run.
The CodeCoveragePlugin
uses the MATLAB profiler to determine which lines of code the tests execute. The tests and
source code should not interact with the profiler. Before running a suite of tests, the
plugin clears any data collected by the profiler.
Instantiate a CodeCoveragePlugin
using one of its static
methods.
To report on source code within one or more files, use the forFile
static method. To report on source code within one or more folders, use the
forFolder
static method. To report on source code within one or
more packages, use the forPackage
static method.
forFile | Construct CodeCoveragePlugin for files |
forFolder | Construct CodeCoveragePlugin for folders |
forPackage | Construct CodeCoveragePlugin for packages |
Handle. To learn how handle classes affect copy operations, see Copying Objects.