title: How do unit tests change when a base class is driven out?
body: <p>This is in part a followup to <a href="https://stackoverflow.com/questions/5601730/tdd-should-private-protected-methods-be-under-unit-test">this question</a>.</p>
  
  <p>I'm not sure the best way to ask this, so I'll try a short story to set the scene:</p>
  
  <p>Once upon a time, there was a class ‘A’, which had a unit test class ‘ATests’ responsible for testing its behaviour through the public interface.  They lived happily together for a while and then a change happened, and class ‘B’ came along, which as it turned out had a lot in common with class ‘A’, so a base class was introduced.  </p>
  
  <p>The public behaviour of the base class is already covered by the tests for class A. So, the question is what happens next?</p>
  
  <p>•   Does class B need to have tests for the common (base class behaviour)?  It seems like the behaviour is a part of B, so it should be tested, but should these tests be shared with those for class A?  For the base class?  If so, what’s the best way to share?</p>
  
  <p>•   Does the new base class need unit tests, or is it ok for base classes to be tested through the tests of their children?  Does it matter if the base class is abstract?</p>
  
  <p>•   Is it enough to ensure that classes A &amp; B derive from the base class and ‘trust’ the unit tests for the base class to test the common behaviour (so the tests don’t need to be replicated in the child classes)?  The tests for A &amp; B only need to test they’re new/changed behaviour?</p>
  
  <p>•   Am I following totally the wrong approach having approximately one unit test class per real class?</p>
  
  <p>I’ve taken different views at different times and the different approaches can have quite an impact on the ability to refactor the code, time taken to write tests etc.  What approaches have people found works best?</p>