Someone in the QA team got a great idea, to improve the quality of the code, we will request developers to cover their code with at least 82.5% by unit test.
I don’t know if like me, you see that great idea often? But I can assure you, the QA in the world agree all together on the most stupid idea of the century, after the KPI on the line of code.
Why do I think like that, here my explanation:
1 On Complex Thinking, we believe a team is a Complex Adaptive System. And by putting an extrinsic constraint on a team, that team will adapt himself. The team will play with the the KPI, so they can focus on delivering values.
2 Code Coverage is only the sole of the true problem we try to achieve. If we ask our self the 5 why, we can agree that the quality problem is not the number of line cover by the test. But the quality of our test. And by asking developers to write test with only reason to cover line of code. We get with more useless unit test that will not alert you when there is a regression.
On #Craftsmanship, or #XP, we believe that we should not write any line of code without a failing test. We use TDD to write our code. TDD is not just test, it is much more beyond a test. TDD allow us to write the code documentation, by writing the behavior we expect. The Crafts who use TDD, doesn’t need code coverage constraint as the coverage is naturally very high. Anything not cover by the test is most probably dead code.
If you want to learn more about TDD, I would more than recommend the new video from CleanCoders, especially the last series between Uncle Bob and Sandro Mancuso
Otherwise come join a Software Craftsmanship community near you, where you will meet others experts.