CppUnit project page | CppUnit home page |
#include <cpput/testcase.h>
Public Member Functions | |
AbstractTestCase (const std::string &name) | |
void | requireResource (const std::string &resourceName) |
Indicates that the test case requires the specified resource. | |
void | prepareResourceAcquisition () |
Prepare the acquisition of resource at the beginning of the test run. | |
bool | runTest () |
Run the test case using the default ExceptionGuard. | |
bool | runTest (const ExceptionGuard &guardsChain) |
Run the test case using the specified ExceptionGuard. | |
void | accept (TestVisitor &visitor) |
bool | isTestCase () const |
Returns true if the class is derived from AbstractTestCase. | |
virtual void | setUp () |
virtual void | run ()=0 |
virtual void | tearDown () |
CppUT::AbstractTestCase::AbstractTestCase | ( | const std::string & | name | ) |
void CppUT::AbstractTestCase::requireResource | ( | const std::string & | resourceName | ) |
Indicates that the test case requires the specified resource.
The specified resource will be acquired before calling setUp() and will be at the earliest after calling tearDown().
resourceName | Name of the resource to acquire. |
void CppUT::AbstractTestCase::prepareResourceAcquisition | ( | ) |
Prepare the acquisition of resource at the beginning of the test run.
This must be called at the beginning of the test run for each test case. It allows couting how many time a resource will be used and during the test run, determining when a resource is no longer needed to free it.
A ResourceLazyPtr is obtained for each required resource via the ResourceHandlerRegistry.
bool CppUT::AbstractTestCase::runTest | ( | ) |
Run the test case using the default ExceptionGuard.
The default exception guard only detect
Referenced by CppUT::OpenTestAdaptor::runTests().
bool CppUT::AbstractTestCase::runTest | ( | const ExceptionGuard & | guardsChain | ) |
Run the test case using the specified ExceptionGuard.
Call TestInfo::startNewTest() before starting the test. Then, setUp(), run() and finally tearDown() are called. run() is only called if setUp() did not failed (no assertion or exception failed during setUp() call).
guardsChain | Call to setUp(), run() and tearDown() are made through the specified exception guard. This allow capturing and extracting information for failure report from exception that do not subclass std::exception. |
References CppTL::bind(), CppUT::TestInfo::discardTestResources(), CppUT::TestStatus::hasFailed(), CppTL::memfn0(), CppTL::memfn1(), CppUT::ExceptionGuard::protect(), CppTL::ref(), run(), setUp(), CppUT::TestInfo::startNewTest(), tearDown(), CppUT::TestInfo::testStatus(), and CppUT::TestInfo::threadInstance().
void CppUT::AbstractTestCase::accept | ( | TestVisitor & | visitor | ) | [virtual] |
bool CppUT::AbstractTestCase::isTestCase | ( | ) | const [virtual] |
void CppUT::AbstractTestCase::setUp | ( | ) | [virtual] |
virtual void CppUT::AbstractTestCase::run | ( | ) | [pure virtual] |
void CppUT::AbstractTestCase::tearDown | ( | ) | [virtual] |
hosts this site. |
Send comments to: CppUnit Developers |