| name | Odoo Test Environments |
| description | This skill should be used when the user asks to "spin up a test Odoo", "create a test environment", "run integration tests against Odoo", "set up testcontainers for Odoo", "provision test data", or mentions Docker-based Odoo testing. |
| version | 0.1.0 |
Odoo Test Environments
Spin up fresh, isolated Odoo instances for testing using Testcontainers. Each test run gets its own PostgreSQL + Odoo container with automatic cleanup.
Installation
npm install @marcfargas/odoo-testcontainers @marcfargas/odoo-client
Quick Start
import { startOdoo } from '@marcfargas/odoo-testcontainers';
const container = await startOdoo({
version: '17.0',
modules: ['sale', 'purchase'],
});
await container.stop();
Presets
Pre-configured module sets for common scenarios:
import { startOdoo, OdooPresets } from '@marcfargas/odoo-testcontainers';
await startOdoo({ ...OdooPresets.hr });
await startOdoo({ ...OdooPresets.sales });
await startOdoo({ ...OdooPresets.accounting });
await startOdoo({ ...OdooPresets.project });
await startOdoo({ ...OdooPresets.full });
Custom Addons
Mount local addon directories into the container:
await startOdoo({
version: '17.0',
addons: [{ hostPath: './my-addons', containerPath: '/mnt/extra-addons' }],
modules: ['my_custom_module'],
});
Seed Database
For faster startup (~15s vs ~3min), use a pre-seeded database image:
export ODOO_SEED_IMAGE=ghcr.io/marcfargas/odoo-test-db:17.0-abc123
The toolbox CI builds seed images weekly. Configure in docker/seed-config.json.
Provisioners
Opt-in helpers for creating test data shapes:
import {
provisionPartners,
provisionProjects,
provisionUsers,
provisionModules,
provisionPartnerCategories,
provisionTaskProperties,
} from '@marcfargas/odoo-testcontainers';
Each provisioner takes an authenticated OdooClient and a configuration object. They handle dependency ordering (e.g., partner categories before partners, projects before tasks).
Vitest Integration
export default defineConfig({
test: {
globalSetup: './tests/helpers/globalSetup.ts',
include: ['tests/**/*.integration.test.ts'],
pool: 'forks',
fileParallelism: false,
},
});
The global setup starts containers once, sets env vars, and tears down after all tests complete.
Supported Versions
Odoo 17, 18, and 19 are tested in CI. Specify the version in startOdoo({ version: '18.0' }).