skunkwerk <skunkw...@gmail.com> writes: > - how difficult/tedious is writing unit tests, and why?
The important thing is to write the tests at the same time as the code. If you do that, it's not too bad. It means the code is then organized around the tests and vice versa. Keeping tests in sync with changes to code can be annoying and it's easy to let that slip under schedule pressure. After that happens enough, you've got a non-TDD program. Writing tests for code that's already been written without automated testing in mind is much more difficult and tedious. Automatically generating tests for already-written code also seems dubious. Also, unit tests themselves are fairly easy, but often you also have to write mock objects to run the tests on and interpret the results. That's actually taken more thought when I've done it. I haven't used the new Python framework for it yet though. > - do you wish you had better code coverage? Sure, we could all use that. On the other hand it slows down development if you overdo it. It's a trade-off like anything else. > - how important is testing to you? If you mean TDD and automated testing, it's very helpful if you're doing something intricate, or if it needs frequent changes and redeployment, etc. For more straightforward tasks, manually testing while you code is ok, especially if it's the type of code for which smoke testing is enough to tell whether the code works. So like anything else, it's a trade-off based on the features and priorities of the task at hand. -- https://mail.python.org/mailman/listinfo/python-list