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 .

Figure C-29. The class TestSetUp


 class TestSetUp : public TestDecorator 


TestSetUp(Test *test)

A constructor taking the Test to decorate.

Public Methods

void run(TestResult *result)

Calls setUp( ) , runs the decorated Test , and calls tearDown( ) .

Protected/Private Methods

virtual void setUp( )

A Protected method called prior to running the decorated Test , allowing custom test fixture behavior to be implemented.

virtual void tearDown( )

A Protected method called after running the decorated Test , 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.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net