CppUnit - The Unit Testing Library

CppUnit project page | FAQ

Public Member Functions | Protected Attributes | List of all members
TestNamer Class Reference

Names a test or a fixture suite. More...

`#include <TestNamer.h>`

## Public Member Functions
| TestNamer (const std::type_info &typeInfo)
| Constructs a namer using the fixture's type-info. More...
| TestNamer (const std::string &fixtureName)
| Constructs a namer using the specified fixture name. More...
virtual | ~TestNamer ()
virtual std::string | getFixtureName () const
| Returns the name of the fixture. More...
virtual std::string | getTestNameFor (const std::string &testMethodName) const
| Returns the name of the test for the specified method. More...
template<typename E >
std::string | getTestNameFor (const std::string &testMethodName, const E &val) const

## Protected Attributes
std::string | m_fixtureName

## Detailed Description

Names a test or a fixture suite.

TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL.

## Constructor & Destructor Documentation

## ◆ TestNamer() [1/2]

CPPUNIT_NS_BEGIN TestNamer::TestNamer | ( | const std::type_info & | typeInfo | ) |

Constructs a namer using the fixture's type-info.

Parameters

  typeInfo | Type-info of the fixture type. Use to name the fixture suite.

## ◆ TestNamer() [2/2]

TestNamer::TestNamer | ( | const std::string & | fixtureName | ) |

Constructs a namer using the specified fixture name.

Parameters

  fixtureName | Name of the fixture suite. Usually extracted using a macro.

## ◆ ~TestNamer()

TestNamer::~TestNamer | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ getFixtureName()

std::string TestNamer::getFixtureName | ( |  | ) | const
| virtual

Returns the name of the fixture.

Returns
  Name of the fixture.

## ◆ getTestNameFor() [1/2]

std::string TestNamer::getTestNameFor | ( | const std::string & | testMethodName | ) | const
| virtual

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 E >

std::string TestNamer::getTestNameFor | ( | const std::string & | testMethodName,
|  | const E & | val
| ) |  | const
| inline

## Member Data Documentation

## ◆ m_fixtureName

std::string TestNamer::m_fixtureName
| protected

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

- TestNamer.h
- TestNamer.cpp

| Send comments to: CppUnit Developers