I would like to specify the order of testing in CppUnit. According to my research, the testing order depends on either the compiler or linker and how they came across the files.
How does one specify dependencies in CppUnit?
For example, let us consider a rectangle class that has four lines. Each line contains two point classes. Assume that each class is in a separate module or translation unit.
struct Point
{
int x;
int y;
};
struct Line
{
Point a;
Point b;
};
struct Rectangle
{
Line top;
Line left;
Line right;
Line bottom;
};
In the above code, the Point class should be tested first, then the Line class and finally the Rectangle class. There is no reason to test the Rectangle class if the Line or Point classes have problems. This is a very simplified example.
For composite classes, the inner classes or member data type classes should be test first.
Let us assume that each class has an associated testing class. Each test class has its own published test methods (which are registered to the CppUnit list), in separate files. The class for testing Lines has no knowledge of the testing class for points; and similar for the rectangle. When these test case classes are compiled, their order is dependent on the compiler and linker.
So, how does one order the test cases?
FYI, I am using CppUnit, wxTestRunner and Visual Studio 2008