Agent skill · software engineering · sickn33
odoo-automated-tests
Write and run Odoo automated tests using TransactionCase, HttpCase, and browser tour tests. Covers test data setup, mocking, and CI integration.
Why this skill is useful
Provides specific patterns and commands for writing and running Odoo tests that the AI wouldn't reliably generate on its own.
What it needs
Requires odoo installed locally. About 2k tokens when loaded. Last updated 2026-08-07. 44,571 stars on the source repository.
What this skill does
Odoo Automated Tests Overview Odoo has a built-in testing framework based on Python's unittest. This skill helps you write TransactionCase unit tests, HttpCase integration tests, and JavaScript tour tests. It also covers running tests in CI pipelines. When to Use This Skill Writing unit tests for a custom model's business logic. Creating an HTTP test to verify a controller endpoint. Debugging test failures in a CI pipeline. Setting up automated test execution with --test-enable. How It Works 1. Activate: Mention @odoo-automated-tests and describe the feature to test. 2. Generate: Get complete test class code with setup, teardown, and assertions. 3. Run: Get the exact odoo CLI command to execute your tests. Examples Example 1: TransactionCase Unit Test (Odoo 15+ pattern) setUpClass vs setUp: Use setUpClass (Odoo 15+) for shared test data. It runs once per class and is significantly faster than setUp which re-initializes for every single test method. Example 2: Run Tests via CLI Example 3: HttpCase for Controller Testing Best Practices ✅ Do: Use setUpClass() with cls.env instead of setUp() — it is dramatically faster for large test suites. ✅ Do: Use @tagged('postinstall', '-atinstall') to run tests after all modules are installed. ✅ Do: Test both the happy path and error conditions (ValidationError, AccessError, UserError). ✅ Do: Use self.withuser(user) to test access control without calling sudo(). ❌ Don't: Use a production database for tests — always use a dedicated test database. ❌ Don't: Rely on test execution order — each TransactionCase test is rolled back in isolation. ❌ Don't: Hardcode passwords in HttpCase.authenticate() — use self.env.user.login or a fixture user. Limitations JavaScript tour tests require a running browser (via phantomjs or Chrome headless) and a live Odoo server — not covered in depth here. HttpCase tests are significantly slower than TransactionCase — use them only for controller/route verification. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills sickn33/odoo-automated-tests