CppUnit - The Unit Testing Library

CppUnit project page | FAQ

TestSuiteBuilderContextBase Class Reference

Context used when creating test suite in HelperMacros. More...

`#include <TestSuiteBuilderContext.h>`

Inheritance diagram for TestSuiteBuilderContextBase:
[legend]
Collaboration diagram for TestSuiteBuilderContextBase:
[legend]

## Public Member Functions
| TestSuiteBuilderContextBase (TestSuite &suite, const TestNamer &namer, TestFixtureFactory &factory)
| Constructs a new context.
virtual | ~TestSuiteBuilderContextBase ()
| TestSuiteBuilderContextBase (TestSuiteBuilderContextBase const &)=default
| TestSuiteBuilderContextBase (TestSuiteBuilderContextBase &&)=default
TestSuiteBuilderContextBase & | operator= (TestSuiteBuilderContextBase const &)=delete
TestSuiteBuilderContextBase & | operator= (TestSuiteBuilderContextBase &&)=delete
void | addTest (Test *test)
| Adds a test to the fixture suite.
std::string | getFixtureName () const
| Returns the fixture name.
std::string | getTestNameFor (const std::string &testMethodName) const
| Returns the name of the test for the specified method.
template<typename T>
std::string | getTestNameFor (const std::string &testMethodName, const T &value) const
| Returns the name of the test for the specified method with the corresponding parameter.
void | addProperty (const std::string &key, const std::string &value)
| Adds property pair.
const std::string | getStringProperty (const std::string &key) const
| Returns property value assigned to param key.

## Protected Types
typedef std::pair< std::string, std::string > | Property
typedef std::vector< Property > | Properties

## Protected Member Functions
TestFixture * | makeTestFixture () const

## Protected Attributes
TestSuite & | m_suite
const TestNamer & | m_namer
TestFixtureFactory & | m_factory

## Private Attributes
Properties | m_properties

## Detailed Description

Context used when creating test suite in HelperMacros.

Base class for all context used when creating test suite. The actual context type during test suite creation is TestSuiteBuilderContext.

See also
  CPPUNIT_TEST_SUITE, CPPUNIT_TEST_SUITE_ADD_TEST, CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS.

## Member Typedef Documentation

## ◆ Properties

typedef std::vector<Property> TestSuiteBuilderContextBase::Properties
| protected

## ◆ Property

typedef std::pair<std::string,std::string> TestSuiteBuilderContextBase::Property
| protected

## Constructor & Destructor Documentation

## ◆ TestSuiteBuilderContextBase() [1/3]

CPPUNIT_NS_BEGIN TestSuiteBuilderContextBase::TestSuiteBuilderContextBase | ( | TestSuite & | suite,
|  | const TestNamer & | namer,
|  | TestFixtureFactory & | factory )

Constructs a new context.

You should not use this. The context is created in CPPUNIT_TEST_SUITE().

## ◆ ~TestSuiteBuilderContextBase()

TestSuiteBuilderContextBase::~TestSuiteBuilderContextBase | ( |  | ) |
| virtual

## ◆ TestSuiteBuilderContextBase() [2/3]

TestSuiteBuilderContextBase::TestSuiteBuilderContextBase | ( | TestSuiteBuilderContextBase const & |  | ) |
| default

## ◆ TestSuiteBuilderContextBase() [3/3]

TestSuiteBuilderContextBase::TestSuiteBuilderContextBase | ( | TestSuiteBuilderContextBase && |  | ) |
| default

## Member Function Documentation

## ◆ addProperty()

void TestSuiteBuilderContextBase::addProperty | ( | const std::string & | key,
|  | const std::string & | value )

Adds property pair.

Parameters

  key | PropertyKey string to add.
  value | PropertyValue string to add.

## ◆ addTest()

void TestSuiteBuilderContextBase::addTest | ( | Test * | test | ) |

Adds a test to the fixture suite.

Parameters

  test | Test to add to the fixture suite. Must not be `NULL`.

## ◆ getFixtureName()

std::string TestSuiteBuilderContextBase::getFixtureName | ( |  | ) | const

Returns the fixture name.

Returns
  Fixture name. It is the name used to name the fixture suite.

## ◆ getStringProperty()

const std::string TestSuiteBuilderContextBase::getStringProperty | ( | const std::string & | key | ) | const

Returns property value assigned to param key.

Parameters

  key | PropertyKey string.

## ◆ getTestNameFor() [1/2]

std::string TestSuiteBuilderContextBase::getTestNameFor | ( | const std::string & | testMethodName | ) | const

Returns the name of the test for the specified method.

Parameters

  testMethodName | Name of the method that implements a test.

Returns
  A string that is the concatenation of the test fixture name (returned by getFixtureName()) andtestMethodName, separated using '::'. This provides a fairly unique name for a given test.

## ◆ getTestNameFor() [2/2]

template<typename T>

std::string TestSuiteBuilderContextBase::getTestNameFor | ( | const std::string & | testMethodName,
|  | const T & | value ) const
| inline

Returns the name of the test for the specified method with the corresponding parameter.

Parameters

  testMethodName | Name (including a parameter) of the method that implements a test.

Returns
  A string that is the concatenation of the test fixture name (returned by getFixtureName()), testMethodName, separated using '::' and the parameter. This provides a fairly unique name for a given test. The parameter must be convertable to std::string through operator<< or a specialization of CPPUNIT_NS::StringHelper::toString needs to exist.

## ◆ makeTestFixture()

TestFixture * TestSuiteBuilderContextBase::makeTestFixture | ( |  | ) | const
| protected

## ◆ operator=() [1/2]

TestSuiteBuilderContextBase & TestSuiteBuilderContextBase::operator= | ( | TestSuiteBuilderContextBase && |  | ) |
| delete

## ◆ operator=() [2/2]

TestSuiteBuilderContextBase & TestSuiteBuilderContextBase::operator= | ( | TestSuiteBuilderContextBase const & |  | ) |
| delete

## Member Data Documentation

## ◆ m_factory

TestFixtureFactory& TestSuiteBuilderContextBase::m_factory
| protected

## ◆ m_namer

const TestNamer& TestSuiteBuilderContextBase::m_namer
| protected

## ◆ m_properties

Properties TestSuiteBuilderContextBase::m_properties
| private

## ◆ m_suite

TestSuite& TestSuiteBuilderContextBase::m_suite
| protected

The documentation for this class was generated from the following files:

- TestSuiteBuilderContext.h
- TestSuiteBuilderContext.cpp

| Send comments to: CppUnit Developers