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


 class RepeatedTest : public TestDecorator 


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.


const int m_timesRepeat

The number of test repetitions to run ( private ).

Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill © 2008-2017.
If you may any questions please contact us: