On Tue, Jun 9, 2009 at 2:20 AM, Alexandre Conrad<[email protected]> wrote: > > But one may argue that unit testing at such low level shouldn't be > required as the higher tests/functional level should cover all > requirements as this is what is exposed to the outside world and only > that exposed part will manipulate the web app. So unit testing may > lead to over-testing, which is as well arguable as it takes time to > update and maintain. > > On the other hand, I tend to think that the functional tests may get > into your way when testing, such as logging and how "environ" may > alter the behavior of controllers. Of course, a setUpClass() > classmethod at the class level could prepare these things, but it's > more work and I feel that I have less control as functional tests call > controllers, which are black boxes.
You have just said why both kinds of tests are important. Unit tests guard against ordinary logic bugs. Functional tests confirm the user's experience, but are harder to troubleshoot because they can fail for many reasons unrelated to the particular thing you're trying to test. So if you have limited time, unit tests give more bang for the buck. The test_models skeleton is just a stub, so feel free to restructure it to whatever works for your model. I don't think the developers knew what the best model-test structure would be, so the suggestions in this thread are probably the best way to go because they've been confirmed to work. Writing realistic functional tests can be a pain when users have to log in and the dataset needs to be realistic (which might mean a copy of the real data, which may be too big to create and destroy for every test, and which is subject to occasional user modifications that may throw off the tests). -- Mike Orr <[email protected]> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
