matlab.unittest.plugins.FailOnWarningsPlugin Class
Namespace: matlab.unittest.plugins
Plugin to fail tests that issue warnings
Description
The FailOnWarningsPlugin
creates a plugin that,
when added to the TestRunner
, 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 FailOnWarningsPlugin
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 or not.A warning is disabled. For example, if you disable a warning using the
SuppressedWarningsFixture
.
Construction
matlab.unittest.plugins.FailOnWarningsPlugin
creates
a plugin that fails any test that issues a warning.
matlab.unittest.plugins.FailOnWarningsPlugin('Ignoring',
creates
a plugin that does not fail for the specified warning identifiers, warnIDs
)warnIDs
.
Input Arguments
Properties
Copy Semantics
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Examples
Tips
Set the warning stack trace display using the
warning
function. For example,warning('off','backtrace')
.Disable warnings using the
SuppressedWarningsFixture
class.
Version History
Introduced in R2015b