Package: matlab.unittest.fixtures
Interface class for test fixtures
The Fixture
interface class is the means
by which test authors create custom fixtures. Fixtures configure the
environment state required for tests.
Classes deriving from the Fixture
interface
must implement the setup
method. This method executes
the changes to the environment. A fixture should restore the environment
to its initial state when it is torn down. To restore the environment,
use the addTeardown
method in the setup
method
or implement the fixture’s teardown
method.
Subclasses can set the SetupDescription
and TeardownDescription
properties
in their constructors to provide descriptions for the actions performed
by the setup
and teardown
methods.
The testing framework can display these descriptions when setting
up and tearing down the fixture.
A class that derives from Fixture
must implement
the isCompatible
method if its constructor accepts
any input arguments or is otherwise configurable. Fixture
subclasses
use this method to define a notion of interchangeability of fixtures.
Two matlab.unittest.fixtures
instances of the same
class are considered to be interchangeable if the isCompatible
method
returns true
. The TestRunner
uses
the result of isCompatible
to determine whether
two fixture instances of the same class correspond to the same shared
test fixture state.
|
Description of fixture setup actions, specified as a character
vector. The |
|
Description of fixture teardown actions, specified as a character
vector. The |
addTeardown | Dynamically add teardown routine to Fixture instance |
applyFixture | Set up fixture to delegate work to another fixture |
isCompatible | Determine if two fixtures of the same class are interchangeable |
log | Record diagnostic information during fixture setup and teardown |
needsReset | Report whether shared test fixture needs to be reset |
onFailure | Dynamically add diagnostics for failures during fixture setup and teardown |
setup | Set up fixture |
teardown | Tear down fixture |
AssertionFailed | Triggered upon failing assertion. A |
AssertionPassed | Triggered upon passing assertion. A |
AssumptionFailed | Triggered upon failing assumption. A |
AssumptionPassed | Triggered upon passing assumption. A |
FatalAssertionFailed | Triggered upon failing fatal assertion. A |
FatalAssertionPassed | Triggered upon passing fatal assertion. A |
ExceptionThrown | Triggered by the |
DiagnosticLogged | Triggered by the |
Handle. To learn how handle classes affect copy operations, see Copying Objects.