Package: matlab.unittest.qualifications
Qualification to abort test execution
The FatalAssertable
class provides a qualification
to abort test execution. Apart from actions performed for failures,
the FatalAssertable
class works the same as matlab.unittest
qualifications.
Upon a fatal assertion failure, the FatalAssertable
class informs the testing framework of the failure by throwing a FatalAssertionFailedException
. The test running framework then displays diagnostic information for the failure and aborts the entire test session. This is useful when the software under test contains so many errors that it does not make sense to continue the test session. Also, you can use fatal assertions in fixture teardown to guarantee the fixture state is restored correctly. If it is not restored, the full testing session will abort and indicate to restart MATLAB® before you resume testing. This allows later tests to run in a consistent MATLAB state. If you can recover the fixture teardown and make it Exception Safe for failures, use assertions instead.
Fatal assertions prevent false test failures due to the failure of a fundamental test. They also prevent false test failures when a prior test failed to restore test fixtures. If the test framework cannot properly tear down fixtures, restart MATLAB to ensure testing can resume in a clean state.
fatalAssertClass | Fatally assert exact class of specified value |
fatalAssertEmpty | Fatally assert value is empty |
fatalAssertEqual | Fatally assert value is equal to specified value |
fatalAssertError | Fatally assert function throws specified exception |
fatalAssertFail | Produce unconditional fatal assertion failure |
fatalAssertFalse | Fatally assert value is false |
fatalAssertGreaterThanOrEqual | Fatally assert value is greater than or equal to specified value |
fatalAssertInstanceOf | Fatally assert value is object of specified type |
fatalAssertLength | Fatally assert value has specified length |
fatalAssertLessThan | Fatally assert value is less than specified value |
fatalAssertLessThanOrEqual | Fatally assert value is less than or equal to specified value |
fatalAssertMatches | Fatally assert string matches specified regular expression |
fatalAssertNotEmpty | Fatally assert value is not empty |
fatalAssertNotEqual | Fatally assert value is not equal to specified value |
fatalAssertNotSameHandle | Fatally assert value is not handle to specified instance |
fatalAssertNumElements | Fatally assert value has specified element count |
fatalAssertReturnsTrue | Fatally assert function returns true when evaluated |
fatalAssertSameHandle | Fatally assert two values are handles to same instance |
fatalAssertSize | Fatally assert value has specified size |
fatalAssertSubstring | Fatally assert string contains specified string |
fatalAssertThat | Fatally assert value meets specified constraint |
fatalAssertTrue | Fatally assert value is true |
fatalAssertWarning | Fatally assert function issues specified warnings |
fatalAssertWarningFree | Fatally assert function issues no warnings |
FatalAssertionFailed | Triggered upon failing fatal assertion. A |
FatalAssertionPassed | Triggered upon passing fatal assertion. A |
Handle. To learn how handle classes affect copy operations, see Copying Objects.
Assertable
| Assumable
| matlab.unittest.qualifications
| QualificationEventData
| TestCase
| Verifiable