CppUnit project page FAQ CppUnit home page

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

CppUnit::TestCase Class Reference

A single test object. More...

#include <TestCase.h>

Inheritance diagram for CppUnit::TestCase:

Inheritance graph
[legend]
Collaboration diagram for CppUnit::TestCase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

 TestCase ()
 Constructs a test case for a suite.

 ~TestCase ()
 Destructs a test case.

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

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

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

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

virtual TestResultrun ()
 A default run method.


Protected Member Functions

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

TestResultdefaultResult ()
 Create a default TestResult.


Private Member Functions

 TestCase (const TestCase &other)
TestCaseoperator= (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< ClassUnderTest >, and CppUnit::TestCaller< Fixture, ExpectedException >.

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

Returns the name of the test case instance.

Implements CppUnit::Test.

Reimplemented in CppUnit::TestCaller< Fixture, ExpectedException >.


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