Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

odoo-test

БесплатноЗапускает вложенные скриптыНе проверен

Comprehensive Odoo testing toolkit for generating test skeletons, running test suites, creating mock data, and analyzing test coverage across Odoo 14-19…

ahmed-lakoshaот ahmed-lakosha★ 79 звёзд на GitHub

Об этом скилле

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

# 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

# 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 t
Полный SKILL.md на GitHub

Установить odoo-test в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash
Glob
Grep
WebFetch

Вложенные файлы

scripts/coverage_reporter.pyscripts/mock_data_factory.pyscripts/test_generator.pyscripts/test_runner.py

FAQ

Что делает скилл 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 trigge

Как установить скилл odoo-test?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл odoo-test запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить odoo-test с