Test

   
Test

Description

The abstract class Test (see Figure C-16) is the central design element of CppUnit, as in other versions of xUnit. It is the base class for all test objects. A Test may consist of a single unit test or of a collection of Test s. When a Test is run, a TestResult collects its results.

All of Test 's methods are virtual and should be overridden by descendant classes.

Test belongs to the namespace CppUnit . It is declared in Test.h and implemented in Test.cpp .

Figure C-16. The abstract class Test
figs/utf_ac16.gif

Declaration

 class Test 

Constructors/Destructors


virtual ~Test( )

A destructor.

Public Methods


virtual int countTestCases( ) const = 0

Returns the number of test cases to be run by this Test .


virtual string getName( ) const = 0

Returns the name of this Test .


virtual void run(TestResult *result) = 0

Runs Test and collects the results in result .


virtual string toString( ) const = 0

Returns a short description of this Test , generally incorporating the name and Test type.

Protected/Private Methods

None.

Attributes

None.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net