Name

TestSuiteBuilder

Description

The template class TestSuiteBuilder (see Figure C-32) is a helper class used to add tests to a TestSuite. It is used by the macros CPPUNIT_TEST_SUITE( ) and CPPUNIT_TEST_SUITE_END( ).

TestSuiteBuilder belongs to the namespace CppUnit. It is declared and implemented in the file extensions/TestSuiteBuilder.h.

The template class TestSuiteBuilder
Figure C-32. The template class TestSuiteBuilder

Declaration

template<typename Fixture> class TestSuiteBuilder

Constructors/Destructors

TestSuiteBuilder(TestSuite *suite)

Constructs a TestSuiteBuilder for a TestSuite.

TestSuiteBuilder(string name)

Constructs a TestSuiteBuilder and a new TestSuite with the given name.

Public Methods

void addTest(Test *test)

Adds test to the TestSuite.

void addTestCaller(string methodName, TestMethod testMethod)

Adds a TestCaller that calls the TestMethod.

void addTestCaller(string methodName, TestMethod testMethod, Fixture *fixture)

Adds a TestCaller that calls the TestMethod in the context of the Fixture.

template<typename ExceptionType> void addTestCallerForException(string methodName, TestMethod testMethod, Fixture *fixture, ExceptionType *dummyPointer)

A template function to add a TestCaller that calls the TestMethod in the context of the Fixture. The TestMethod is expected to throw an Exception of type ExceptionType.

string makeTestName(const string &methodName)

Returns a test name that incorporates the TestSuite ...

Get Unit Test Frameworks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.