CppUnit project page | FAQ |
Wraps a test case with setUp and tearDown methods.A TestFixture is used to provide a common environment for a set of test cases. More...
#include <TestFixture.h>
Public Member Functions | |
virtual | ~TestFixture () |
virtual void | setUp () |
Set up context before running a test. | |
virtual void | tearDown () |
Clean up after the test run. |
Wraps a test case with setUp and tearDown methods.
A TestFixture is used to provide a common environment for a set of test cases.
To define a test fixture, do the following:
Each test runs in its own fixture so there can be no side effects among test runs. Here is an example:
For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling CPPUNIT_ASSERT on the expression you want to test:
Once the methods are defined you can run them. To do this, use a TestCaller.
The tests to be run can be collected into a TestSuite.
A set of macros have been created for convenience. They are located in HelperMacros.h.
|
inlinevirtual |
|
inlinevirtual |
Set up context before running a test.
Reimplemented in TestCaller< Fixture >, and TestCaseDecorator.
|
inlinevirtual |
Clean up after the test run.
Reimplemented in TestCaller< Fixture >, and TestCaseDecorator.
Send comments to: CppUnit Developers |