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.
I'm trying to develop an application that regularly downloads some government data (in XML), parses the data and then updates a database. Simple enough in theory, but the problem I'm hitting is where to begin with tests on data that is ALL over the place. The agency in question performs little data validation, so a given field can have a huge range of possible inputs (e.g. - a Boolean field should be 0 or 1, but might be blank, have a negative number or even strings like the word 'None'). 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? Or given the range of possible inputs, should I simply skip testing for valid data at the parser level, and instead worry about flagging (or otherwise handling) invalid input at the database-insertion layer (and therefore write tests at that layer)? Or should I not be testing data values at all, but rather the results of actions performed on that data? It seems like these questions must be a subset of the issues in the realm of testing. Can anyone recommend a resource on the types of tests that should be applied to the various tasks and stages of the development process? A friend recommended The Art of Software Testing -- is that the type of book that covers these issues? If so, can anyone recommend a suitable alternative that costs less than $100? As always, I appreciate the advice. Regards, Serdar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor