Name
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.
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 theTest
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 theRepeatedTest
.
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
).
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.