Running tests

The tests are written, so now it's time to run them. For that, we just need to add the --test-enable option to the Odoo server start command, while installing or upgrading (-i or -u) the addon module.

The command will look like this:

$ ./odoo-bin -d todo --test-enable -u todo_stage --stop-after-init

Only the modules installed or upgraded will be tested. If some dependencies need to be installed, their tests will run too. If you want to avoid this, you can install the module you wish to test the usual way, and then run the tests while performing an upgrade (-u) of the module to test.

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.