Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
is there way to write tests for a bunch of classes by using their common interface class instead?
I want to write a test only once using the interface defined by the root parent but I also want this particular test to run for every instance of the derived classes (for example by providing the instances through factorys).
How could I accomplish this in an elegant way?
Hi there! I found a solution myself, but it is not a particularly prety one. Here is an example (suppose IVehicle is the interface class to Car and Truck).
template <class T>
class IVehicleTest : public CPPUNIT_NS::TestFixture
pVehicle = new T();
CPPUNIT_ASSERT( pVehicle->wrumwrum() );
If you have got any better Ideas please tell me! Since the test output of the above approach does not work correctly.