CppUnit project page FAQ CppUnit home page

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CppUnit::TestCase Class Reference

A single test object. More...

#include <TestCase.h>

Inheritance diagram for CppUnit::TestCase:

CppUnit::Test CppUnit::TestFixture CppUnit::Orthodox CppUnit::TestCaller List of all members.

Public Methods

 TestCase (std::string Name)
 Constructs a test case. More...

 TestCase ()
 Constructs a test case for a suite. More...

 ~TestCase ()
 Destructs a test case. More...

virtual void run (TestResult *result)
 Run the test and catch any exceptions that are triggered by it. More...

virtual int countTestCases () const
 Returns a count of all the tests executed. More...

std::string getName () const
 Returns the name of the test case. More...

std::string toString () const
 Returns the name of the test case instance. More...

virtual TestResultrun ()
 A default run method. More...


Protected Methods

virtual void runTest ()
 All the work for runTest is deferred to subclasses. More...

TestResultdefaultResult ()
 Create a default TestResult. More...


Private Methods

 TestCase (const TestCase &other)
TestCase & operator= (const TestCase &other)

Private Attributes

const std::string m_name

Detailed Description

A single test object.

This class is used to implement a simple test case: define a subclass that overrides the runTest method.

You don't usually need to use that class, but TestFixture and TestCaller instead.

You are expected to subclass TestCase is you need to write a class similiar to TestCaller.


Constructor & Destructor Documentation

CppUnit::TestCase::TestCase std::string    name
 

Constructs a test case.

Parameters:
name  the name of the TestCase.

CppUnit::TestCase::TestCase  
 

Constructs a test case for a suite.

This TestCase is intended for use by the TestCaller and should not be used by a test case for which run() is called.

CppUnit::TestCase::~TestCase  
 

Destructs a test case.

CppUnit::TestCase::TestCase const TestCase &    other [private]
 


Member Function Documentation

int CppUnit::TestCase::countTestCases   const [virtual]
 

Returns a count of all the tests executed.

Implements CppUnit::Test.

CppUnit::TestResult * CppUnit::TestCase::defaultResult   [protected]
 

Create a default TestResult.

std::string CppUnit::TestCase::getName   const [virtual]
 

Returns the name of the test case.

Implements CppUnit::Test.

TestCase& CppUnit::TestCase::operator= const TestCase &    other [private]
 

TestResult * CppUnit::TestCase::run   [virtual]
 

A default run method.

void CppUnit::TestCase::run TestResult   result [virtual]
 

Run the test and catch any exceptions that are triggered by it.

Implements CppUnit::Test.

void CppUnit::TestCase::runTest   [protected, virtual]
 

All the work for runTest is deferred to subclasses.

Reimplemented in CppUnit::Orthodox.

std::string CppUnit::TestCase::toString   const [virtual]
 

Returns the name of the test case instance.

Implements CppUnit::Test.

Reimplemented in CppUnit::TestCaller.


Member Data Documentation

const std::string CppUnit::TestCase::m_name [private]
 


The documentation for this class was generated from the following files:
SourceForge Logo hosts this site. Send comments to:
CppUnit Developers