addTeardown
Class: matlab.unittest.fixtures.Fixture
Namespace: matlab.unittest.fixtures
Dynamically add teardown code to fixture
Description
addTeardown(
registers the teardown code fixture
,teardownFcn
)teardownFcn
with the fixture. To
dynamically run teardown code when the testing framework tears down the fixture, call
addTeardown
within the setup
method of your Fixture
subclass.
To restore the environment, the method enforces a last-in, first-out (LIFO) policy so
that teardown actions are performed in the reverse order of their corresponding setup
actions. Use addTeardown
to achieve test content that is exception
safe.
addTeardown(
also specifies the input arguments with which fixture
,teardownFcn
,input1,...,inputN
)teardownFcn
is invoked
for fixture teardown.
Input Arguments
Examples
Alternatives
Instead of specifying teardown code by calling the addTeardown
method
within the setup
method, you can implement the teardown
method.
Version History
Introduced in R2014a