matlab.unittest.plugins.FailOnWarningsPlugin Class
Namespace: matlab.unittest.plugins
Superclasses: matlab.unittest.plugins.QualifyingPlugin
, matlab.unittest.plugins.TestRunnerPlugin
, matlab.unittest.plugins.Parallelizable
Plugin that fails tests that issue warnings
Description
The matlab.unittest.plugins.FailOnWarningsPlugin
class provides a plugin that fails any test that issues a
warning. The plugin produces a qualification failure in the test scope that issues the
warning. For example, if a shared test fixture issues a warning, the plugin produces a
qualification failure on the fixture and fails all tests that share the fixture.
The plugin does not produce a failure if:
A test accounts for the warning through a constraint such as
IssuesWarnings
orIssuesNoWarnings
, regardless of whether the constraint is satisfied.The warning is disabled, for example, using the
SuppressedWarningsFixture
class.The plugin is explicitly instructed to ignore the warning.
The matlab.unittest.plugins.FailOnWarningsPlugin
class is a handle
class.
Creation
Description
plugin = matlab.unittest.plugins.FailOnWarningsPlugin
creates a
plugin that fails any test that issues a warning.
plugin = matlab.unittest.plugins.FailOnWarningsPlugin(Ignoring=
ignores warnings with the specified identifiers. For example, identifiers
)plugin =
matlab.unittest.plugins.FailOnWarningsPlugin(Ignoring="MATLAB:singularMatrix")
creates a plugin that does not fail tests because of the specified warning.
Input Arguments
Properties
Examples
Tips
To set the warning stack trace display, use the
warning
function. For example,warning("off","backtrace")
disables display of the stack trace.To suppress the display of warnings when testing, use the
matlab.unittest.fixtures.SuppressedWarningsFixture
class.
Version History
Introduced in R2015b