addTeardown

Class: matlab.unittest.fixtures.Fixture
Package: matlab.unittest.fixtures

Dynamically add teardown routine

Syntax

addTeardown(fixture,tearDownFcn)
addTeardown(fixture,tearDownFcn,arg1,...,argN)

Description

addTeardown(fixture,tearDownFcn) adds the tearDownFcn function handle that defines fixture teardown code to the fixture instance. The teardown code is executed in the reverse order to which it is added. This is known as LIFO (or last-in, first-out).

addTeardown(fixture,tearDownFcn,arg1,...,argN) provides input arguments to the tearDownFcn.

Input Arguments

fixture

matlab.unittest.fixtures.Fixture instance

tearDownFcn

Function that defines the fixture teardown code, specified as a function handle.

arg1,...,argN

Input arguments required by tearDownFcn, specified by any type. The argument type is specified by the tearDownFcn function argument list.

Alternatives

Instead of defining teardown actions within the setup method by implementing the addTeardown method, you can implement the teardown method.