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::TestSuite Class Reference
[Creating TestSuite]

A Composite of Tests. More...

#include <TestSuite.h>

Inheritance diagram for CppUnit::TestSuite:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TestSuite (std::string name="")
 Default constructor.

 ~TestSuite ()
 Destructor.

void run (TestResult *result)
 Runs the tests and collects their result in a TestResult.

int countTestCases () const
 Counts the number of test cases that will be run by this test.

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

std::string toString () const
 Returns a string representation of the test suite.

void addTest (Test *test)
 Adds a test to the suite.

const std::vector< Test * > & getTests () const
virtual void deleteContents ()
 Deletes all tests in the suite.


Private Member Functions

 TestSuite (const TestSuite &other)
TestSuiteoperator= (const TestSuite &other)

Private Attributes

std::vector< Test * > m_tests
const std::string m_name

Detailed Description

A Composite of Tests.

It runs a collection of test cases. Here is an example.

 CppUnit::TestSuite *suite= new CppUnit::TestSuite();
 suite->addTest(new CppUnit::TestCaller<MathTest> (
                  "testAdd", testAdd));
 suite->addTest(new CppUnit::TestCaller<MathTest> (
                  "testDivideByZero", testDivideByZero));
Note that TestSuites assume lifetime control for any tests added to them.

TestSuites do not register themselves in the TestRegistry.

See also:
Test

TestCaller


Constructor & Destructor Documentation

CppUnit::TestSuite::TestSuite std::string  name = ""  ) 
 

Default constructor.

CppUnit::TestSuite::~TestSuite  ) 
 

Destructor.

CppUnit::TestSuite::TestSuite const TestSuite other  )  [private]
 


Member Function Documentation

void CppUnit::TestSuite::addTest Test test  ) 
 

Adds a test to the suite.

int CppUnit::TestSuite::countTestCases  )  const [virtual]
 

Counts the number of test cases that will be run by this test.

Implements CppUnit::Test.

void CppUnit::TestSuite::deleteContents  )  [virtual]
 

Deletes all tests in the suite.

std::string CppUnit::TestSuite::getName  )  const [virtual]
 

Returns the name of the test suite.

Implements CppUnit::Test.

const std::vector< Test * > & CppUnit::TestSuite::getTests  )  const
 

TestSuite& CppUnit::TestSuite::operator= const TestSuite other  )  [private]
 

void CppUnit::TestSuite::run TestResult result  )  [virtual]
 

Runs the tests and collects their result in a TestResult.

Implements CppUnit::Test.

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

Returns a string representation of the test suite.

Implements CppUnit::Test.


Member Data Documentation

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

std::vector<Test *> CppUnit::TestSuite::m_tests [private]
 


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