[TIP] testing: why bother?
phlip2005 at gmail.com
Wed Mar 23 10:29:55 PDT 2011
On Wed, Mar 23, 2011 at 6:06 AM, Alfredo Deza <alfredodeza at gmail.com> wrote:
> I am about to give a presentation about testing in a couple of days and the
> audience is in its majority a
> "we do not write tests" one :(
> If you had to name the single most important reason why you need to write
> tests (or keep up with them) what
> would that reason be?
Without TDD unit tests... if you have a bug, you must debug it.
Debugging is long, slow, and arduous. It screws up a schedule by being
impossible to predict.
With unit tests, if a test fails unexpectedly, you have the option to
revert your code back to the last point where it all passed. Then you
can try your change a different way, without debugging.
You don't always get that effect - sometimes you still must debug. And
you get the effect by diligently writing tests until they are a
burden. Under LAMP, they typically take too long to run!
You don't get something for nothing, but the ability to Undo and 'git
reset' your way out of debugging should be considered a miracle to
anyone who has been mired in test-free code for years.
More information about the testing-in-python