|We don't bite newbies here... much|
Re^4: Does anybody write tests first?by xdg (Monsignor)
|on Feb 25, 2008 at 19:12 UTC||Need Help??|
Finally, it is a proven and incontestable fact that the single, simplest, cheapest, most effective way to avoid bugs is to write less code. And tests are code.
And program code is code. Therefore, if you write no code at all, you'll have no bugs. Of course, you'll also have no features.
Testing is a science and tests should be designed, not hacked together as after-thoughts (or pre-thoughts).
So is your objection to writing tests first as opposed to after the fact? Or to hacky, poorly-designed tests, regardless of whether they were written first or last?
My hypothesis would be that tests are more likely to be designed well when they are viewed by the developer as an integral part of the development of program code rather than something to be added afterwards -- at least with respect to individual developers.
If your development model has QA developers writing tests independently, then maybe the advantage is less.
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.