MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
originating from the test content at the corresponding level. Since both TestCase and
Fixture instances inherit from the handle class, you add these listeners using the
addlistener method. The methods that set up, run and tear down test content extend
the way the TestRunner evaluates the test content.

Extending Test Level Plugin Methods


The TestRunnerPlugin methods at the test level extend the creation, setup, run, and
teardown of a single test suite element. A single test element consists of one test method
or, if the test is parameterized, one instance of the test’s parameterization.

Type of Method Test Level Falls Within Scope of runTest
creation method createTestMethodInstance
setup method setupTestMethod
run method runTestMethod
teardown method teardownTestMethod

At this level, the createTestMethodInstance method is the only plugin method with
an output argument. It returns the TestCase instances created for each Test element.
The test framework passes each of these instances into corresponding Test methods, and
into any methods with the TestMethodSetup or TestMethodTeardown attribute.

The test framework evaluates methods at the test level within the scope of the runTest
method. Provided the test framework completes all TestMethodSetup work, it invokes
the plugin methods in this level a single time per test element.

Extending Test Class Level Plugin Methods


The TestRunnerPlugin methods at the test class level extend the creation, setup, run,
and teardown of test suite elements that belong to the same test class or the same
function-based test. These methods apply to a subset of the full TestSuite that the
TestRunner runs.

Type of Method Test Class Level Falls Within Scope of runTestClass
creation method createTestClassInstance
setup method setupTestClass

33 Unit Testing

Free download pdf