[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7145GNQ3FTBH8X0KB2Q5K1Y":3,"skill-same:01M7145GNQ3FTBH8X0KB2Q5K1Y":65},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":14,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":50,"install":51,"resources":64},"01M7145GNQ3FTBH8X0KB2Q5K1Y","odoo-automated-tests",null,"Write and run Odoo automated tests using TransactionCase, HttpCase, and browser tour tests. Covers test data setup, mocking, and CI integration.","sapsapshen\u002Fai-memory-router","sapsapshen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20347959?v=4","01M6XDQEF1DP50DKF37H81J3J5","shenmian","01M6XDQEJPE41Y3DT2763X8ZJN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcopilot\u002Fodoo-automated-tests\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"odoo","odoo automated tests","tests","safe","test","setup","run","browser","integration","ci","data","write","test data","self","mocking","tour","2026-11-10 10:12:30",false,"---\nname: odoo-automated-tests\ndescription: \"Write and run Odoo automated tests using TransactionCase, HttpCase, and browser tour tests. Covers test data setup, mocking, and CI integration.\"\nrisk: safe\nsource: \"self\"\n---\n\n# Odoo Automated Tests\n\n## Overview\n\nOdoo 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.\n\n## When to Use This Skill\n\n- Writing unit tests for a custom model's business logic.\n- Creating an HTTP test to verify a controller endpoint.\n- Debugging test failures in a CI pipeline.\n- Setting up automated test execution with `--test-enable`.\n\n## How It Works\n\n1. **Activate**: Mention `@odoo-automated-tests` and describe the feature to test.\n2. **Generate**: Get complete test class code with setup, teardown, and assertions.\n3. **Run**: Get the exact `odoo` CLI command to execute your tests.\n\n## Examples\n\n### Example 1: TransactionCase Unit Test (Odoo 15+ pattern)\n\n```python\n# tests\u002Ftest_hospital_patient.py\nfrom odoo.tests.common import TransactionCase\nfrom odoo.tests import tagged\nfrom odoo.exceptions import ValidationError\n\n@tagged('post_install', '-at_install')\nclass TestHospitalPatient(TransactionCase):\n\n    @classmethod\n    def setUpClass(cls):\n        # Use setUpClass for performance — runs once per class, not per test\n        super().setUpClass()\n        cls.Patient = cls.env['hospital.patient']\n        cls.doctor = cls.env['res.users'].browse(cls.env.uid)\n\n    def test_create_patient(self):\n        patient = self.Patient.create({\n            'name': 'John Doe',\n            'doctor_id': self.doctor.id,\n        })\n        self.assertEqual(patient.state, 'draft')\n        self.assertEqual(patient.name, 'John Doe')\n\n    def test_confirm_patient(self):\n        patient = self.Patient.create({'name': 'Jane Smith'})\n        patient.action_confirm()\n        self.assertEqual(patient.state, 'confirmed')\n\n    def test_empty_name_raises_error(self):\n        with self.assertRaises(ValidationError):\n            self.Patient.create({'name': ''})\n\n    def test_access_denied_for_other_user(self):\n        # Test security rules by running as a different user\n        other_user = self.env.ref('base.user_demo')\n        with self.assertRaises(Exception):\n            self.Patient.with_user(other_user).create({'name': 'Test'})\n```\n\n> **`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.\n\n### Example 2: Run Tests via CLI\n\n```bash\n# Run all tests for a specific module\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database -u hospital_management\n\n# Run only tests tagged with a specific tag\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database \\\n  --test-tags hospital_management\n\n# Run a specific test class\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database \\\n  --test-tags \u002Fhospital_management:TestHospitalPatient\n```\n\n### Example 3: HttpCase for Controller Testing\n\n```python\nfrom odoo.tests.common import HttpCase\nfrom odoo.tests import tagged\n\n@tagged('post_install', '-at_install')\nclass TestPatientController(HttpCase):\n\n    def test_patient_page_authenticated(self):\n        # Authenticate as a user, not with hardcoded password\n        self.authenticate(self.env.user.login, self.env.user.login)\n        resp = self.url_open('\u002Fhospital\u002Fpatients')\n        self.assertEqual(resp.status_code, 200)\n\n    def test_patient_page_redirects_unauthenticated(self):\n        # No authenticate() call = public\u002Fanonymous user\n        resp = self.url_open('\u002Fhospital\u002Fpatients', allow_redirects=False)\n        self.assertIn(resp.status_code, [301, 302, 403])\n```\n\n## Best Practices\n\n- ✅ **Do:** Use `setUpClass()` with `cls.env` instead of `setUp()` — it is dramatically faster for large test suites.\n- ✅ **Do:** Use `@tagged('post_install', '-at_install')` to run tests after all modules are installed.\n- ✅ **Do:** Test both the happy path and error conditions (`ValidationError`, `AccessError`, `UserError`).\n- ✅ **Do:** Use `self.with_user(user)` to test access control without calling `sudo()`.\n- ❌ **Don't:** Use a production database for tests — always use a dedicated test database.\n- ❌ **Don't:** Rely on test execution order — each `TransactionCase` test is rolled back in isolation.\n- ❌ **Don't:** Hardcode passwords in `HttpCase.authenticate()` — use `self.env.user.login` or a fixture user.\n\n## Limitations\n\n- **JavaScript tour tests** require a running browser (via `phantomjs` or `Chrome headless`) and a live Odoo server — not covered in depth here.\n- `HttpCase` tests are significantly slower than `TransactionCase` — use them only for controller\u002Froute verification.\n- Does not cover **mocking external services** (e.g., mocking an SMTP server or payment gateway in tests).\n- Test isolation is at the **transaction level**, not database level — tests that commit data (e.g., via `cr.commit()`) can leak state between tests.\n","# Odoo Automated Tests\n\n## Overview\n\nOdoo 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.\n\n## When to Use This Skill\n\n- Writing unit tests for a custom model's business logic.\n- Creating an HTTP test to verify a controller endpoint.\n- Debugging test failures in a CI pipeline.\n- Setting up automated test execution with `--test-enable`.\n\n## How It Works\n\n1. **Activate**: Mention `@odoo-automated-tests` and describe the feature to test.\n2. **Generate**: Get complete test class code with setup, teardown, and assertions.\n3. **Run**: Get the exact `odoo` CLI command to execute your tests.\n\n## Examples\n\n### Example 1: TransactionCase Unit Test (Odoo 15+ pattern)\n\n```python\n# tests\u002Ftest_hospital_patient.py\nfrom odoo.tests.common import TransactionCase\nfrom odoo.tests import tagged\nfrom odoo.exceptions import ValidationError\n\n@tagged('post_install', '-at_install')\nclass TestHospitalPatient(TransactionCase):\n\n    @classmethod\n    def setUpClass(cls):\n        # Use setUpClass for performance — runs once per class, not per test\n        super().setUpClass()\n        cls.Patient = cls.env['hospital.patient']\n        cls.doctor = cls.env['res.users'].browse(cls.env.uid)\n\n    def test_create_patient(self):\n        patient = self.Patient.create({\n            'name': 'John Doe',\n            'doctor_id': self.doctor.id,\n        })\n        self.assertEqual(patient.state, 'draft')\n        self.assertEqual(patient.name, 'John Doe')\n\n    def test_confirm_patient(self):\n        patient = self.Patient.create({'name': 'Jane Smith'})\n        patient.action_confirm()\n        self.assertEqual(patient.state, 'confirmed')\n\n    def test_empty_name_raises_error(self):\n        with self.assertRaises(ValidationError):\n            self.Patient.create({'name': ''})\n\n    def test_access_denied_for_other_user(self):\n        # Test security rules by running as a different user\n        other_user = self.env.ref('base.user_demo')\n        with self.assertRaises(Exception):\n            self.Patient.with_user(other_user).create({'name': 'Test'})\n```\n\n> **`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.\n\n### Example 2: Run Tests via CLI\n\n```bash\n# Run all tests for a specific module\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database -u hospital_management\n\n# Run only tests tagged with a specific tag\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database \\\n  --test-tags hospital_management\n\n# Run a specific test class\n.\u002Fodoo-bin --test-enable --stop-after-init -d my_database \\\n  --test-tags \u002Fhospital_management:TestHospitalPatient\n```\n\n### Example 3: HttpCase for Controller Testing\n\n```python\nfrom odoo.tests.common import HttpCase\nfrom odoo.tests import tagged\n\n@tagged('post_install', '-at_install')\nclass TestPatientController(HttpCase):\n\n    def test_patient_page_authenticated(self):\n        # Authenticate as a user, not with hardcoded password\n        self.authenticate(self.env.user.login, self.env.user.login)\n        resp = self.url_open('\u002Fhospital\u002Fpatients')\n        self.assertEqual(resp.status_code, 200)\n\n    def test_patient_page_redirects_unauthenticated(self):\n        # No authenticate() call = public\u002Fanonymous user\n        resp = self.url_open('\u002Fhospital\u002Fpatients', allow_redirects=False)\n        self.assertIn(resp.status_code, [301, 302, 403])\n```\n\n## Best Practices\n\n- ✅ **Do:** Use `setUpClass()` with `cls.env` instead of `setUp()` — it is dramatically faster for large test suites.\n- ✅ **Do:** Use `@tagged('post_install', '-at_install')` to run tests after all modules are installed.\n- ✅ **Do:** Test both the happy path and error conditions (`ValidationError`, `AccessError`, `UserError`).\n- ✅ **Do:** Use `self.with_user(user)` to test access control without calling `sudo()`.\n- ❌ **Don't:** Use a production database for tests — always use a dedicated test database.\n- ❌ **Don't:** Rely on test execution order — each `TransactionCase` test is rolled back in isolation.\n- ❌ **Don't:** Hardcode passwords in `HttpCase.authenticate()` — use `self.env.user.login` or a fixture user.\n\n## Limitations\n\n- **JavaScript tour tests** require a running browser (via `phantomjs` or `Chrome headless`) and a live Odoo server — not covered in depth here.\n- `HttpCase` tests are significantly slower than `TransactionCase` — use them only for controller\u002Froute verification.\n- Does not cover **mocking external services** (e.g., mocking an SMTP server or payment gateway in tests).\n- Test isolation is at the **transaction level**, not database level — tests that commit data (e.g., via `cr.commit()`) can leak state between tests.\n",{"name":5,"risk":27,"source":37,"description":7},"main","7a38d8e7073e61c16eda85681cb32fb68a8657a5","skills-store\u002Fcopilot\u002Fodoo-automated-tests","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router","https:\u002F\u002Fgithub.com\u002Fsapsapshen","2026-04-14 21:12:12",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add sapsapshen\u002Fai-memory-router --skill odoo-automated-tests",{"tool":57,"command":58},"bunx","bunx skills add sapsapshen\u002Fai-memory-router --skill odoo-automated-tests",{"tool":60,"command":61},"pnpm","pnpm dlx skills add sapsapshen\u002Fai-memory-router --skill odoo-automated-tests","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcopilot\u002Fodoo-automated-tests\u002FSKILL.md",true,[],[66,76,83,91,97,105],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":70,"licenseFileUrl":71,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":75},"01M72R8PZX1ABFHJGTYPA4CAF1","webapp-testing","To test local web applications, write native Python Playwright scripts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":75},"01M72QG37MMZNDY7X7GXPAK5W6","python-packaging","Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fpython-packaging\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":70,"licenseFileUrl":87,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":75},"01M72NXR0QMP9G46TW6A2DH59C","canvas-design","These are instructions for creating design philosophies - aesthetic movements that are then EXPRESSED VISUALLY. Output only .md files, .pdf files, and .png files.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FSKILL.md",[],[],{"skillNo":92,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":70,"licenseFileUrl":93,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":75},"01M72N55TK3EEQ4QK4AWDC2KZS","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":70,"licenseFileUrl":101,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":75},"01M72MTWC150CFAP4Y5GSNKF80","slack-gif-creator","A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":70,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":75},"01M72KPT3VVNSP88MNAY466TZT","frontend-design","You are a frontend designer-engineer, not a layout generator.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FSKILL.md",[],[]]