Home › Curriculum › Odoo Developer › Automated tests: TransactionCase, Form, HttpCase and tours
Testing, quality and performance · 16 min · 17–20Automated tests: TransactionCase, Form, HttpCase and tours
Writing and running Odoo tests: test classes, tags, setup, Form emulation, HTTP and tour tests.
In this lesson
- TransactionCase, setUpClass and tags
- Form emulation, HttpCase and tours
- Running tests and CI
Key points
- tests/ imported in tests/__init__.py; TransactionCase rolls back
- @tagged('post_install','-at_install'); setUpClass(cls) with cls.env
- Form for UI-like behaviour; HttpCase url_open and start_tour
- --test-tags /module --stop-after-init; CI on every push
Real-world example
A credit-block module passed manual testing but failed when sales orders were confirmed from the website. A TransactionCase test confirming an order as the public user reproduced it; the fix (checking the commercial partner) and the test now protect every release.
Questions and answers
How do you run only your module's tests?
--test-tags /module_name
What does Form() give you over create()?
It runs onchanges, defaults and UI logic like a user would.