Programmers Should Test Their Own Code

A programmer who relies upon QA, testers, other programmers, or customers to test their code is a BadProgrammer.

And the motivation is?

Hear hear!

Microsoft hires a lot of contractors for a position called "Software Development Engineer in Test". Yep, guys whose entire job is to write UnitTests. It works about as well as you'd think.


I've had managers tell me to *stop* testing, as QA has "taken full responsibility" for doing *ALL* testing.

"They're 'the testing people;' they'll do all the testing."
"Development will save so much time, by having programmers not do any testing at all."

Phphphphphphppppp!!!!!! I've yet to see such a situation even come close to believable, in terms of working.

-- JeffGrigg


But programmers tend to choose expected scenarios for testing, not border cases. How should we ensure robustness without external testers?

Unwarranted inference. Programmers testing their own code doesn't imply that nobody else tests it. Programmers do correctness testing; customers do acceptance testing; and QA do exploratory testing. Note that I'm not saying "should" here - I'm saying that this is what happens by the nature of each role, and what matters is whether the roles are being performed effectively or not. -- LaurentBossavit

Unwarranted? Maybe. But well supported by anecdotal evidence. Unless you exist in some sort of eXtreme nirvana, of course. -- AlexeyVerkhovsky

Well, there does seem to be some tension in the minds of some managers that having test-writing duties overlap for both programmers and external QA folks is excessive and wasteful. Personally I think that the programmer has a unique insight into possible edge cases where bugs slip in, since often those bugs are more apparent in the implementation than in the interface. If that programmer is conscientious about the whole endeavor to start with, that is. -- francis

And that's quite an "if". One of the reasons for external testers' existence is the common case where the programmer is not conscientious enough. It is a very tricky issue. Programmers must test their own code well, but how does one make sure that they do it well enough? -- alex

External testers must test the code well, but how does one make sure that they do it well enough? The problem still exists, it merely has been shifted to a different party. The question is which party is in the best position to do the task well.

Choosing an alternative that is not so imperfect as the other is not a useful paradigm here. Think about a system consisting of two imperfect components that form a feedback loop. --AlexeyVerkhovsky


This is a principle long recognized by Dr. WilliamEdwardsDeming, that a worker must be responsible for his own work. If there is a programmer and a tester, who is responsible for the quality of the software? When pushed for time, does the programmer rely on the tester to catch problems? When pushed for time, does the tester rely on the programmer to have written the code correctly?

The principle is quite simple. If the programmer does not have enough knowledge and information to test the program, then he does not have enough knowledge and information to write the program.


EditText of this page (last edited July 2, 2004) or FindPage with title or text search