Hello, In my latest project I'm finally implementing unit tests from square one, trying to get as close to 100% test coverage as possible. Being new to unit testing I've noticed that almost all online information, including anything in the Pylons documentation and book, deals with the easy part: how writing unit tests works technically and what tools can help you write them. However, the more interesting (and difficult) question is not "how" to test, but "what" to test for.
What to test for is something you learn from experience (i.e. testing for similar bugs to what you've encountered in the past or if a supposedly fixed bug might pop up again). Does anyone have any useful experiences or thoughts about the rationale behind their unit tests? It would be interesting to compile some best practices and general patterns for writing unit tests for Pylons-based applications (even if it are just some general tips or ideas, though specific issues you've experienced are very interesting as well). Back to my own project: I'm still working on writing the models and, of course, their unit tests. If you have any ideas about pitfalls to avoid or better ways to test here are the tests as I've written them so far: http://bitbucket.org/fmw/edgar/src/tip/edgar/tests/ My own experiences so far: - the concept of writing tests before you write the actual code from test-driven development is worth sticking to, as it is harder to guarantee the integrity of the tests if you do it the other way around, and, - it is not enough to recreate your tables before running each test, meaning you need to actually clean up model.Session at the same time (i.e. purge open transactions that might still contain remnants from previous tests). My apologies if this is outside of the scope of the list. -Filip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
