Unit tests

Automated tests are generally accepted as a best practice in software. They not only help us ensure our code is correctly implemented, but more importantly they provide a safety net for future code changes or rewrites.

In the case of dynamic programming languages, such as Python, since there is no compilation step, syntax errors can go unnoticed. This makes it even more important to have unit tests going through as many lines of code as possible.

The two goals described can provide a guiding light when writing tests. The first goal for your tests should be to provide good test coverage, designing test cases that go through all your lines of code.

This alone will usually make good progress on the second goal – to show the functional ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.