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

A Composite of Tests. More...

#include <TestSuite.h>

Inheritance diagram for CppUnit::TestSuite:

CppUnit::Test List of all members.

Public Methods

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

 ~TestSuite ()
 Destructor. More...

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

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

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

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

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

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


Private Methods

 TestSuite (const TestSuite &other)
TestSuite & operator= (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