I've created parent and child test test classes to test a number of production code classes that all derive from a parent class. The parent test class (Class A) inherits from the CPPUNIT test fixture. The child class (class B) inherits from class A.
Class A has test methods used to test the functionality of the production code classes. Class B has test methods named similar to class A but class B instantiates instances of the production classes and then calls the parent test classes of class A to run the tests.
This scheme allows me to create a unit test program for each type of production class by creating versions of the small class B code, each one instantiating a different production class.
Everything works fine - except that if a CPPUNIT assertion fails in the class A code the program aborts instead of recording the failure and proceeding as it should. This occurs for any type of assertion from equality tests to simple CPPUNIT_FAIL(message) calls.
I can conceive of several ways to work around this but none are very attractive. I've read about the "SUB" classes but this doesn't seem to be what I want. I don't want any of the class A methods to be run except when called by the child class B methods.
Any help would be appreciated.
Thanks,
Tom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've created parent and child test test classes to test a number of production code classes that all derive from a parent class. The parent test class (Class A) inherits from the CPPUNIT test fixture. The child class (class B) inherits from class A.
Class A has test methods used to test the functionality of the production code classes. Class B has test methods named similar to class A but class B instantiates instances of the production classes and then calls the parent test classes of class A to run the tests.
This scheme allows me to create a unit test program for each type of production class by creating versions of the small class B code, each one instantiating a different production class.
Everything works fine - except that if a CPPUNIT assertion fails in the class A code the program aborts instead of recording the failure and proceeding as it should. This occurs for any type of assertion from equality tests to simple CPPUNIT_FAIL(message) calls.
I can conceive of several ways to work around this but none are very attractive. I've read about the "SUB" classes but this doesn't seem to be what I want. I don't want any of the class A methods to be run except when called by the child class B methods.
Any help would be appreciated.
Thanks,
Tom