odoo-test
Comprehensive Odoo testing toolkit for generating test skeletons, running test suites, creating mock data, and analyzing test coverage across Odoo 14-19. Supports TransactionCase, HttpCase, SavepointCase, and integrates with Azure DevOps for CI/CD test result reporting. <example> Context: User wants test cases for a custom model user: "Generate test cases for my custom sale.order extension module" assistant: "I will use the odoo-test skill to analyze the model definition and generate TransactionCase test skeletons covering CRUD operations, computed fields, and business logic." <commentary>Core trigger - test skeleton generation from model definition.</commentary> </example> <example> Context: User wants mock data for testing user: "Create realistic mock data for testing my inventory module" assistant: "I will use the odoo-test skill to generate a mock data factory with realistic product, partner, and stock.move records using Odoo demo data patterns." <commentary>Test data creation trigger.</commentary> </example> <example> Context: User wants to analyze test coverage user: "Show me which parts of my module have no test coverage" assistant: "I will use the odoo-test skill to scan the module for untested models, methods, and views, then generate a coverage report with priority recommendations." <commentary>Coverage analysis trigger - finding gaps in the test suite.</commentary> </example> <example> Context: User wants test skeletons for a model user: "Generate test cases for my sale.order extension" assistant: "I will analyze the model definition and generate TransactionCase test skeletons covering CRUD, computed fields, and business logic." <commentary>Test generation trigger.</commentary> </example> <example> Context: User wants mock data user: "Create realistic mock data for testing my inventory module" assistant: "I will generate a mock data factory with realistic product, partner, and stock.move records using Odoo demo data patterns." <commentary>Mock data trigger.</commentary> </example> <example> Context: User wants to run tests user: "Run tests for my custom module with post_install tag" assistant: "I will execute the test suite with --test-enable and --test-tags=post_install, showing colored output." <commentary>Test run trigger.</commentary> </example> <example> Context: User wants coverage analysis user: "Show me which parts of my module have no test coverage" assistant: "I will scan for untested models, methods, and views, then generate a coverage report with priority recommendations." <commentary>Coverage analysis trigger.</commentary> </example> <example> Context: User wants E2E tests user: "Generate Playwright E2E tests for my Odoo module" assistant: "I will create Playwright test files covering login, navigation, form submission, and data validation for the module's web interface." <commentary>E2E test trigger.</commentary> </example>
What this skill does
# Odoo Testing Toolkit Skill (v2.0)
> **v2.0 Architecture**: All testing operations available via `/odoo-test` sub-commands or natural language.
A comprehensive skill for generating, running, and analyzing tests across Odoo 14-19. Covers unit tests, integration tests, HTTP controller tests, mock data creation, and test coverage analysis. Includes CI/CD integration patterns for Azure DevOps pipelines.
## Configuration
- **Supported Versions**: Odoo 14, 15, 16, 17, 18, 19
- **Primary Version**: Odoo 17
- **Test Patterns**: 80+ documented patterns
- **Mock Data Generators**: 20+ field-type-aware generators
- **Core Base Class**: `odoo.tests.common.TransactionCase`
- **Test Runner**: Built-in Odoo test framework + CLI scripts
---
## Quick Reference
### All Commands
| Command | Purpose | Example |
|---------|---------|---------|
| `/odoo-test` | Full testing workflow | `/odoo-test my_module` |
| `/test-generate` | Generate test skeleton | `/test-generate --model my.model --module /path/to/module` |
| `/test-run` | Run test suite | `/test-run my_module --tags post_install` |
| `/test-coverage` | Analyze coverage | `/test-coverage /path/to/module` |
| `/test-data` | Generate mock data | `/test-data --model res.partner --count 10` |
### One-Liner Command Reference
```bash
# Generate test skeleton for a model
python test_generator.py --model sale.order --module /c/odoo/odoo17/projects/myproject/my_module
# Run tests for a module
python -m odoo -c conf/project17.conf -d project17 --test-enable -i my_module --stop-after-init
# Run tests with specific tags
python -m odoo -c conf/project17.conf -d project17 --test-enable --test-tags=post_install --stop-after-init
# Run specific test class
python -m odoo -c conf/project17.conf -d project17 --test-enable --test-tags=/my_module:TestMyModel --stop-after-init
# Analyze coverage
python coverage_reporter.py --module /path/to/my_module
# Generate 10 mock partner records
python mock_data_factory.py --model res.partner --count 10
```
---
## Testing Architecture
### Test Class Hierarchy
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ ODOO TEST CLASS HIERARCHY │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ unittest.TestCase (Python standard) │
│ └── odoo.tests.common.BaseCase │
│ ├── TransactionCase ← MOST COMMON │
│ │ • Each test wrapped in transaction rolled back on completion │
│ │ • Full ORM access via self.env │
│ │ • Database state reset between tests │
│ │ • setUpClass() for shared expensive setup │
│ │ │
│ ├── SavepointCase (Odoo 14-15) / TransactionCase with savepoints │
│ │ • Allows partial rollback within a test │
│ │ • Useful for testing exception handling │
│ │ • Use self.cr.savepoint() context manager │
│ │ │
│ └── HttpCase ← FOR WEBSITE/API │
│ • Starts real HTTP server on localhost │
│ • Supports phantom_js() / browser_js() │
│ • Supports jsonrpc() / url_open() │
│ • Full route testing with authentication │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
### TransactionCase vs HttpCase vs SavepointCase
| Feature | TransactionCase | SavepointCase | HttpCase |
|---------|----------------|---------------|----------|
| DB Isolation | Per test (rollback) | Per class (savepoints) | Per test (rollback) |
| HTTP server | No | No | Yes (localhost) |
| Speed | Fast | Medium | Slow |
| Best for | ORM/business logic | Exception testing | Routes, UI, JSON |
| Auth control | Direct `self.env` | Direct `self.env` | `self.authenticate()` |
| Access | `env.user` | `env.user` | Via HTTP session |
### When to Use Each
```python
# TransactionCase - Business logic, CRUD, compute, constraints, workflows
class TestSaleOrder(TransactionCase):
def test_order_confirmation(self):
order = self.env['sale.order'].create({...})
order.action_confirm()
self.assertEqual(order.state, 'sale')
# HttpCase - Website routes, API endpoints, authenticated pages
class TestWebsiteController(HttpCase):
def test_shop_page(self):
self.authenticate('admin', 'admin')
res = self.url_open('/shop')
self.assertEqual(res.status_code, 200)
# SavepointCase - When you need to test that an exception rolls back properly
class TestConstraints(TransactionCase):
def test_constraint_rollback(self):
with self.assertRaises(ValidationError):
self.env['my.model'].create({'required_field': False})
```
---
## Test Tagging System
### Tag Decorator Reference
```python
from odoo.tests import tagged
# Most common - runs after all modules installed (stable environment)
@tagged('post_install', '-at_install')
class TestMyModel(TransactionCase):
pass
# Runs during module install (early execution, limited env)
@tagged('at_install', '-post_install')
class TestEarlyLogic(TransactionCase):
pass
# Standard tests (default, equivalent to post_install)
@tagged('standard')
class TestStandard(TransactionCase):
pass
# Explicitly exclude from automatic runs
@tagged('-standard', 'manual')
class TestManualOnly(TransactionCase):
pass
# Multiple tags
@tagged('post_install', '-at_install', 'sale', 'critical')
class TestSaleIntegration(TransactionCase):
pass
```
### Tag Precedence Rules
```
Tag with '-' prefix = EXCLUSION (remove from selection)
Tag without '-' = INCLUSION (add to selection)
Default run: --test-tags=standard
Post-install: --test-tags=post_install (most common for production tests)
Examples:
--test-tags=post_install → all post_install tagged tests
--test-tags=my_module → all tests in module my_module
--test-tags=/my_module:MyClass → specific class in module
--test-tags=/my_module:MyClass.test_method → specific method
```
### Built-in Odoo Tags
| Tag | When it runs | Use case |
|-----|-------------|----------|
| `standard` | Default CI runs | Unit tests, business logic |
| `at_install` | During install | Basic module integrity |
| `post_install` | After all installs | Integration, full env tests |
| `slow` | Skipped by default | Long-running tests |
| `external` | Skipped by default | External API tests |
| `multi_company` | Special flag | Multi-company scenarios |
---
## Writing Tests
### Complete CRUD Test Pattern
```python
from odoo.tests import TransactionCase, tagged
from odoo.exceptions import ValidationError, UserError
@tagged('post_install', '-at_install')
class TestMyModel(TransactionCase):
"""Test suite for my.model CRUD operations and business logic."""
@classmethod
def setUpClass(cls):
"""Set up class-level fixtures shared across all tests in this class.
Called once before any test method in the class.
"""
super().setUpClass()
# Create shared records (not rolled back between tests)
cls.partner = cls.env['res.partner'].create({
'name': 'Test Partner',
'email': '[email protected]',
})
cls.currency = cls.env.ref('base.USD')
cls.company = cls.Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.