[Tutor] the art of testing

Lie Ryan lie.1296 at gmail.com
Tue Nov 24 21:20:07 CET 2009

Serdar Tumgoren wrote:
> Hi everyone,
> The list recently discussed the virtues of unit testing, and I was
> hoping someone could offer some high-level advice and further
> resources as I try to apply the TDD methodology.

TDD is different from data validation. TDD ensures program correctness. 
Data validation ensures input correctness.

> In such a case, should I be writing test cases for *expected* inputs
> and then coding the the parser portion of my program to handle the
> myriad of possible "bad" data?

Yes, the parser should handle all bad data and respond in appropriate 
manner (raise an error or flag for manual check by programmer). Input 
should be sanitized as early as possible.

If you want to apply TDD here; you will be checking that the parser 
correctly normalize all "bad" data into the proper form (e.g. all 0, 
None, False, <empty></empty> in the boolean field is properly normalized 
to False (I assume there is no difference between each different 
representation of False?)).

More information about the Tutor mailing list