Name
TestSetUp
Description
The class TestSetUp
(see Figure C-29) is a
subclass of TestDecorator
that implements
setUp( )
and tearDown( )
methods for the decorated Test
. This allows the
Test
object’s test fixture
behavior to be modified without subclassing it.
TestSetUp
belongs to the namespace
CppUnit
. It is declared in the file
extensions/TestSetUp.h and implemented in the
file TestSetUp.cpp.
Declaration
class TestSetUp : public TestDecorator
Constructors/Destructors
-
TestSetUp(Test *test)
A constructor taking the
Test
to decorate.
Public Methods
-
void run(TestResult *result)
Calls
setUp( )
, runs the decoratedTest
, and callstearDown( )
.
Protected/Private Methods
-
virtual void setUp( )
A
Protected
method called prior to running the decoratedTest
, allowing custom test fixture behavior to be implemented.-
virtual void tearDown( )
A
Protected
method called after running the decoratedTest
, allowing the test fixture to be cleaned up.-
TestSetUp(const TestSetUp &)
A copy constructor declared
private
to prevent its use.-
void operator=(const TestSetUp &)
A copy operator declared
private
to prevent its use.
Attributes
None.
Get Unit Test Frameworks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.