Unit Test Frameworks

   
RepeatedTest

Description

The class RepeatedTest (see Figure C-11) is a subclass of TestDecorator . It runs a Test for a specified number of repetitions.

RepeatedTest belongs to the namespace CppUnit . It is declared in extensions/RepeatedTest.h and implemented in RepeatedTest.cpp .

Figure C-11. The class RepeatedTest

Declaration

class RepeatedTest : public TestDecorator

Constructors/Destructors

RepeatedTest(Test *test, int timesRepeat)

A constructor taking the Test to run and the number of repetitions.

Public Methods

int countTestCases( ) const

Returns the number of test cases that this RepeatedTest will run, which is the number of test cases the Test contains multiplied by the number of repetitions.

void run(TestResult *result)

A method to run the RepeatedTest .

string toString( ) const

Returns a string representation of the RepeatedTest .

Protected/Private Methods

RepeatedTest(const RepeatedTest &)

A copy constructor declared private to prevent its use.

void operator=(const RepeatedTest &)

A copy operator declared private to prevent its use.

Attributes

const int m_timesRepeat

The number of test repetitions to run ( private ).

Категории