I would like to indicate the testing order in CppUnit. According to my research, the order of testing depends on either the compiler or the linker, and how they came across the files.
How to define dependencies in CppUnit?
For example, consider a rectangle class that has four lines. Each row contains two point classes. Suppose each class is in a separate translation module or block.
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 must first be checked, then the Line class, and finally the Rectangle class. There is no reason to check the Rectangle class if the Line or Point classes have problems. This is a very simplified example.
For compound classes, inner classes or member data type classes must first be checked.
Suppose each class has a testing class associated with it. Each test class has its own published test methods (which are registered in the CppUnit list), in separate files. Class for testing Lines does not know the testing class for points; and similarly for a rectangle. When these test classes are compiled, their order depends on the compiler and linker.
So how to organize test cases?
FYI, I am using CppUnit, wxTestRunner and Visual Studio 2008
source share