[TIP] Testing in General
michael at quuxo.com
Tue Mar 31 15:37:36 PDT 2009
On Tue, 2009-03-31 at 18:20 -0400, David Blewett wrote:
> I was going to start by putting in coverage testing, so that I can
> start adding tests to the most active sections of my codebase. Any
> advice is appreciated.
Just get some initial tests running, just a couple. This is generally
the biggest hurdle since it takes time away from doing what you really
want to do — hacking on your app. These initial tests also serve as
templates for adding more, making it easier to do so.
Once you have some tests in place, be stringent about adding to them as
you go. Got a bug? Add a test for it, fix the actual problem and watch
as your test stops failing. Adding a new feature? Add tests for the code
you write as you go. Code that's testable can often be cleaner in
design, so it's well worth doing this.
I'd rarely bother writing a whole bunch of new tests for an existing
application because typically you need to inspect the code to work out
what you should be testing, which leads to tests that trivially pass.
It's also rather soul-sucking for me. If you do choose to however,
deliberately break your code while writing a test, then unbreak it once
the test is done to make sure the test is actually working. It should go
from failing to success.
Michael Gratton <michael at quuxo.com>
Quuxo Software <http://web.quuxo.com/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090401/500238fa/attachment.pgp
More information about the testing-in-python