We're having a hypothetical conversation with Joe, a developer in a Scrum team.
- Joe, how is your team doing in terms of unit tests?
- Very good! We have a developer in our team, Jack, who is proficient in writing good unit tests. He works with other developers to understand what they are planning to implement and then writes dozens of unit tests that they can use to validate their work.
- Wait a minute, so he's the only one in the team who writes unit tests?
- Yes. That's his specialization. Because of this, not only is he able to write really good, maintainable tests, but is also so productive that an average of five tests per day is for him a piece of cake.
- But the unit tests aren't a separate development activity, they are integral part of developing the right code!
- This is what I used read on the Internet, but the reality is what we are doing here is in accordance with the independency principle.
- Tell me more about it.
- We are avoiding the Initial Error. If one developer writes the tests and another writes the implementation we know that they compared one thing against the other. If the same person would write the test and the implementation we would risk misinterpreting the requirements and doing wrong test for wrong implementation, with the test still passing.
- You must be kidding me (...)
OK, I could go on like this for hours. Remember: do not let anybody talk you into the Initial Error or Independent Unit Testing story. Consider the following short example, as an argument against views like those Joe presents.
You've bought one of these fancy new TV sets that can be hanged on the wall. In order to mount it, you need to mount a handle onto the wall. When the handle is mounted, the rest is simple - the TV set is compatible with the handle and you just put it on the handle. The trouble is, it takes more than one screw to mount the handle to the wall. How are you going to mount the handle so that it is in perfectly horizontal position? Use tape measure, perhaps? Or even a laser device to set the screws precisely? I might be a good idea, but our old friend Joe comes along and denies you the use of a tape measure, not to mention the laser. He says:
I will bring here a friend of mine with tape measure and the laser and once you are finished with the mounting he will measure it precisely to independently see whether your understanding of the word "horizontal" is same as yours.