matlab.unittest.plugins.CodeCoveragePlugin.forPackage

Class: matlab.unittest.plugins.CodeCoveragePlugin
Package: matlab.unittest.plugins

Construct CodeCoveragePlugin for packages

Description

matlab.unittest.plugins.CodeCoveragePlugin.forPackage(package) creates a plugin that produces a code coverage report for one or more packages. The plugin reports on the source code inside package.

matlab.unittest.plugins.CodeCoveragePlugin.forPackage(package,Name,Value) produces a code coverage report with additional options specified by one or more Name,Value pair arguments. For example, matlab.unittest.plugins.CodeCoveragePlugin.forPackage('myprojA','IncludingSubpackages',true) produces a code coverage report for source code in the myprojA package and its subpackages.

Input Arguments

expand all

Names of package containing source code, specified as a character vector, a cell array of character vectors, or a string array. If you specify multiple packages, MATLAB® opens a profile coverage report for each package.

The parent folder of the top-level source code package must be on the MATLAB path and remain on the path during the test run.

Example: 'myproject.controller'

Example: {'myprojA','myprojB'}

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: matlab.unittest.plugins.CodeCoveragePlugin.forPackage('myprojA','IncludingSubpackages',true) produces a code coverage report for source code in the myprojA package and its subpackages.

Setting to include source code in subpackages of package, specified by false or true. By default, CodeCoveragePlugin does not report on source code in subpackages.

Data Types: logical

Report format, specified as either a matlab.unittest.plugins.codecoverage.CoverageReport instance or an instance of a different class in the matlab.unittest.plugins.codecoverage package. By default, the report format is matlab.unittest.plugins.codecoverage.CoverageReport, which displays a MATLAB Code Coverage Report.

Example: matlab.unittest.plugins.codecoverage.CoberturaFormat('CoverageResults.xml')

Introduced in R2014b