[TIP] Testing Hierarchy

Marius Gedminas marius at gedmin.as
Tue Jul 21 12:06:35 PDT 2009


On Mon, Jul 20, 2009 at 11:22:37PM -0700, Noah Gift wrote:
> I agree with most of the really good points in this thread, which I forget
> if I hijacked or not :), but the elephant in the room is you CAN actually
> write ok code without testing if some of these factors are in place such as:
> 
> 1.  The problem is trivial.

This happened to me several times:

  * I write trivial, short (< 5 lines), can't-possibly-be-wrong code
  * I debate writing a test since the code is obviously correct
  * I write a test anyway since not doing it would break the pretty 100%
    coverage number for this module
  * My test discovers a silly slap-the-head-of-course! bug

It's possible that the bug would've been discovered quickly anyway, so I
cannot claim the test have save the day.  Still, it's nice.

I've been writing automated tests for 7 years now, and cannot say I've
learned how to do that yet (my tests are often slowish -- especially in
aggregate --, have large-ish fixtures, and are sometimes difficult to
debug).  Perhaps I should spent a week *reading* good test suites.  Any
pointers?

Marius Gedminas
-- 
I assume by "b59757e468227127b91fff17b523da4deec8b04d" you meant
66fb253082ea42179180303393e48846208987fa.
            -- Aaron Plattner uses git
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090721/6a3863a4/attachment.pgp 


More information about the testing-in-python mailing list