in reply to Inheriting Tests and Other Test Design Issues
I'm not sure that inheritance is the correct thing. In fact, I'm not really sure why you would use inheritance. You're tests should be testing behaviors. So, if two classes have the same behaviors, they should be tested together. For example, if I have a class A and subclass B and they both have a method foo and a->foo() will be equal to b->foo() in all cases, then they should be tested together in the same place.
So, what I would do is something somewhat different from what you have above. For class A and subclass B, I would write:
Then, down the road, if I create a new subclass of A, I may have to refactor my test cases to cover all my bases, but it will keep me from repeating code.
|
|---|