odoo-automated-tests

Featured

Write and run Odoo automated tests using TransactionCase, HttpCase, and browser tour tests. Covers test data setup, mocking, and CI integration.

AI & Automation 49,938 stars 7238 forks Updated today MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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) ```python # tests/test_hospital_patient.py from odoo.tests.common import TransactionCase from odoo.tests import tagged from odoo.exceptions import ValidationError @tagged('post_install', '-at_install') class TestHospitalPatient(TransactionCase): @classmethod def setUpClass(cls): # Use setUpClass for performance — runs once per class, not per test super().setUpClass() cls.Patient = cls.env['hospital.patient'] cls.doctor = cls.env['res.users'].browse(cls.env.uid) def test_create_patient(self): patient = self.Patient.create({ 'name': 'John Doe', 'doctor_id': self.doctor.id, ...

Details

Author
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
10 months ago
Last Updated
today
Language
Python
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category