| Unit tests assert implementation behaviour to aid refactoring. If developers misunderstand the spec, the unit tests can be valid. They don't assert developer understanding. Say it with me, unit tests are to aid refactoring. If we mix QA and implementation details just because both sides use the word "test" it ends in trouble. QA should be blind to unit test coverage or even usage at all, they're totally independent concerns. A passing unit test says nothing against correctness of product against a spec or design... only that it works and continues to work as a developer intended, to aid the work of future developers, even if they misunderstood the spec. Your comment is at the core of why QA is a total mess. Everyone is confused about what "test" means in different contexts. Why have a QA function at all with 100% unit test coverage? Because the unit tests may encode misunderstanding by developers. They're there to fight entropy, not wrongness. QA, using BDD and other tools, ensure the product is correct, regardless of how well it fights entropy by unit tests. |
Tests in general can only help you refactor code at a lower level of granularity than what you are testing. Something lower than unit level is a contradiction.
Of course, you can instead test business behavior which isn't as volatile in refactoring and change your definition of unit to be a unit of practical business requirements...