I do test
If you are coming from the I don't test section and are now convinced to do test-driven development, then congratulations! You know the basics of test-driven development, but there are some more things you should learn before you will be able to efficiently use this methodology.
This section describes a few problems developers bump into when they write tests and some ways to solve them. It also provides a quick review of popular test runners and tools available in the Python community.
unittest pitfalls
The unittest
module was introduced in Python 2.1 and has been massively used by developers since then. But some alternative test frameworks were created in the community by people who were frustrated with the weaknesses and limitations of unittest
.
These are the common criticisms that are often made:
- The framework is heavy to use because:
- You have to write all your tests in subclasses of
TestCase
- You have to prefix the method names with
test
- You are encouraged to use assertion methods...
- You have to write all your tests in subclasses of