fatalAssertUsing
Class: matlab.unittest.plugins.QualifyingPlugin
Namespace: matlab.unittest.plugins
Fatally assert that value satisfies given constraint
Syntax
fatalAssertUsing(plugin,context,actual,constraint)
fatalAssertUsing(plugin,context,actual,constraint,diagnostic)
Description
fatalAssertUsing(
fatally asserts that plugin
,context
,actual
,constraint
)actual
is a value that satisfies the given
constraint, constraint
, using the qualification
context
. If the actual value does not satisfy the constraint, the
testing framework reports a fatal assertion failure.
You can perform fatal assertions in these QualifyingPlugin
methods:
setupSharedTestFixture
teardownSharedTestFixture
setupTestClass
teardownTestClass
setupTestMethod
teardownTestMethod
fatalAssertUsing(
displays
the diagnostic information, plugin
,context
,actual
,constraint
,diagnostic
)diagnostic
, upon
failure.
Input Arguments
Examples
Use Qualifications in Plugin
See examples for the QualifyingPlugin
class
and replace calls to verifyUsing
with fatalAssertUsing
.
Tips
Use the QualifyingPlugin.fatalAssertUsing
method
to abort the test session upon failure. These qualifications are useful
when the failure mode is so fundamental that there is no point in
continuing testing. These qualifications are also useful when fixture
teardown does not restore the MATLAB® state correctly and it is
preferable to abort testing and start a fresh session. Alternatively,
Use the
QualifyingPlugin.verifyUsing
method to produce and record failures without throwing an exception. Because aQualifyingPlugin
performs additional qualifications beyond the ones defined in the unit tests, it typically uses verifications. Verifications do not cause an early exit from the test, ensuring that the test framework executes all test content. Use other qualification types to test for violation of preconditions or incorrect test setup.Use the
QualifyingPlugin.assumeUsing
method to ensure that the test environment meets preconditions that otherwise do not result in a test failure. Assumption failures result in filtered tests, and the testing framework marks the associated test content asIncomplete
.Use the
QualifyingPlugin.assertUsing
method when the failure condition invalidates the remainder of the current test content, but does not prevent proper execution of subsequent test methods. A failure at the assertion point renders the associated test content as failed and incomplete.
Version History
Introduced in R2015b