Why automated testing for custom Odoo modules matters before an upgrade
Automated tests catch regressions in custom Odoo code before go-live and before each upgrade, so a business running custom modules can change or move its platform without relying on someone clicking through every screen. Custom modules are the part of an Odoo system most likely to break at upgrade time, because they inherit models, override methods and extend views that the standard apps change between versions. A test suite that runs on every change tells the team which of its own behavior still holds, and it keeps working after the original developer has left.
Odoo provides three layers of testing for custom code. Python test classes built on TransactionCase and related base classes check models, computed fields, access rules and business methods inside a database transaction that is rolled back after each test. JavaScript tests cover client-side components, and tours drive the web client through a user workflow, such as confirming a sale order, to confirm that the screens still behave. Tests run when a module is installed or updated with the test flag, which means the test database has to be prepared for it. Your supported edition and hosting option decide where those tests can run: Odoo.sh builds, your own CI pipeline on a server you control, or a local staging copy. Confirm which option your plan supports before you design the pipeline, and check the current Odoo upgrade documentation for the steps that apply to your version.
The practical question for a business is who owns this suite and whether it is maintained as the platform changes. Tests cost effort to write, to keep passing when standard Odoo code changes, and to run on every build. Ask any partner to show which behaviors the suite covers, how it runs against the upgraded test database before production, and who fixes failing tests after an upgrade. Those answers determine whether the suite protects the upgrade or becomes another stalled project.
Which test types cover which custom code
Custom Odoo code runs in several layers: server-side Python, HTTP endpoints, the Owl client and the browser. Each test type sees a different slice of that stack, so a gap in one layer often stays hidden until a user or an upgrade finds it. The cards below set out what each layer catches and what it leaves uncovered.
Python TransactionCase unit tests
These tests call model methods directly inside a transaction that rolls back after each test, which keeps them fast and isolated. They suit computed fields, onchange logic, constraints and the business rules in your overrides of standard methods. They do not exercise views, access rights applied through the web client or the HTTP layer, so a rule that passes here can still be hidden or blocked for a real user. Check that each override you wrote has a test for its normal path and its edge case, such as an empty recordset or a multi-company record.
HttpCase controller and flow tests
HttpCase tests start a real HTTP server and send requests to your controllers, JSON endpoints and portal routes. They catch broken routes, wrong authentication requirements and responses that change between versions, which matters when you expose data to integrations. They are slower than unit tests and do not prove that the page renders correctly in a browser. Confirm that each public or API route has a test for an unauthenticated request, a user without the right group and an authorized user.
JavaScript unit tests for Owl components
Owl component tests mount your client-side components in isolation and check their state, props and rendered output against mocked services. They catch regressions when you patch a standard component or change a QWeb template, which is where client customizations most often break after an upgrade. They do not show whether the component works with the real server data or the surrounding page. Pin down which standard components you patch, since each patch is a test you must keep passing when the framework changes.
Tours for end-to-end user journeys
Tours script a browser session through a business process, such as quoting a sale, confirming it and validating the delivery. They catch problems that only appear when the layers work together, including a button that no longer appears, a form that blocks the next step and a menu that a group cannot reach. Tours are the slowest and most brittle layer, and they miss rare data shapes. Keep a small set covering your critical processes and attach each to a named role so that failures point to a permission problem or a workflow problem.
Install and upgrade smoke tests
Tests that run when your module is installed or updated check that the data files, views and security rules load without errors on a clean database. They catch missing dependencies, broken XML references and access rule files that reference removed groups. They do not confirm that business logic behaves correctly. Before an upgrade, run the install path on the target version in a copy of production, since a module that installs cleanly on the current version can still fail once a standard model or view changes upstream.
Access rights and record rule tests
Permission tests run the same operation as users in different groups and assert which records they can read, write or delete. They catch the gap between what a developer expects a role to see and what the security files actually grant, including multi-company leaks. They do not check whether the business rule is correct, only whether access is enforced. Build a table of roles against key models and make it part of each release check, because a standard upgrade can add groups or change inherited rules.
Where tests run and when each option fits
This table compares four places custom Odoo tests run: module install with the test flag, a local developer run, a CI pipeline on self-hosted runners, and Odoo.sh builds. Read each row to see who runs the tests, what the environment needs, and where the option falls short. The main takeaway is that most teams need more than one option, since fast local feedback and a shared, repeatable gate serve different purposes.
| Option | Who runs it and what it needs | Trade-offs and when it fits |
|---|---|---|
| Test flag on module install | A developer or admin runs the install command with the test flag against a disposable test database, with the module and its dependencies available to the server | Simple and close to production code paths, but it is slow for routine work and depends on someone remembering to run it. Fits checking a module in a fresh database before merging or upgrading |
| Local developer run | The developer runs tests on a workstation or dev container with a local PostgreSQL instance and the same Odoo version as the project, plus a headless browser if tours are included | Fastest feedback while coding and easy to target a single test class, but results depend on local setup. Fits iterative development; confirm the local Odoo and PostgreSQL versions match the target |
| CI pipeline on self-hosted runners | A pipeline job, run on runners you operate, that installs Odoo and the custom addons, starts PostgreSQL, and runs the test flag and tours with a headless browser installed on the runner | Repeatable and enforceable on every merge request, but you own runner capacity, images, browser versions and database services. Fits teams with several developers or an upgrade branch that must pass before deployment |
| Odoo.sh builds | Odoo.sh runs test builds for hosted projects; the feature is available only on the Custom plan, which also covers on-premise hosting, so confirm that plan before relying on it | Less infrastructure to maintain and tied to the hosting platform, but you have less control over the environment and test configuration. Fits Custom plan customers who host on Odoo.sh; confirm build and test behavior in Odoo's documentation |
| Test database and data | Each option needs a database that matches the target version; for production-like copies, the documented duplication with neutralization is used so tests do not send emails or call live services | Realistic data finds more defects but adds copy time and privacy handling. Fits upgrade rehearsals, where the copy should be refreshed before each run |
Setting up a test suite for a custom module
This sequence turns a custom Odoo module from untested code into one with a registered test suite that runs on install, covers core business rules and critical screens, and executes automatically in CI or an Odoo.sh build. Each step closes with a check the team can repeat before an upgrade.
Create the test directory and register tests
A developer creates a
testsdirectory inside the custom module, adds an__init__.pyfile that imports each test file, and lists the test modules there. The module's__manifest__.pyfile is checked so that tests are not loaded in production code paths by mistake. The check is a fresh install of the module on a throwaway database, where the test modules load without import errors and Odoo reports the module as installed.Write TransactionCase tests for business rules
A developer writes Python tests that subclass
TransactionCaseand cover the rules the business depends on, such as computed totals, state transitions, constraints and access to records through the ORM. Each test creates its own data insetUpClassor the test method, so the result does not depend on the order of execution. The check is that each rule has at least one test asserting the expected outcome and one asserting that an invalid input raises the expected error.Add JavaScript unit tests for client logic
Where the module changes the web client, a developer adds JavaScript tests for custom components, field widgets or helper functions, using the test harness that ships with Odoo's web framework. These tests run in a browser context and cover behavior that Python tests cannot reach. The check is that the JavaScript test runner reports the new tests as executed, not skipped, in the same run as the Python tests.
Write tour tests for critical screens
A developer records or writes tour tests that walk a user through the screens a business process depends on, such as creating a quotation, confirming it and validating a delivery. Tours run in a headless browser against a database, so they catch broken views, missing buttons and failed server calls that unit tests miss. Tours are kept to a few high-value paths, because they are slower and more sensitive to layout changes. The check is that each tour completes from start to finish on a clean database.
Run tests on module install and as a suite
Odoo can run a module's tests when it is installed or updated in test mode, and a developer uses that option against a database that mirrors the target environment. The team confirms which tags are included in the run and that the test results are written to the log. The check is a run with a deliberately broken assertion that fails, followed by a fix that passes, which confirms that failures are reported and not swallowed.
Wire the run into CI or Odoo.sh builds
The team adds a pipeline step, in the CI system the organization uses, or a build configuration on Odoo.sh, that installs the custom module on a fresh database and runs its tests on every merge request or push. The pipeline must fail when a test fails, and the team confirms which Odoo version, Python version and database settings the build uses. The check is a pipeline run triggered by a commit that breaks a test, showing a red build, and a later commit that restores the test and returns the build to green.
Confirm the suite before an upgrade
Before a version upgrade, the team runs the full suite on the target Odoo version in a test database, and records which tests fail and why. Failures in business rule tests point to changed standard behavior that needs a decision, while failures in tour tests usually point to changed views. The team should confirm with its partner or with Odoo's upgrade documentation how the upgraded test database will be produced, since the upgrade service works from a test copy. The check is a documented pass or fail result per test, which becomes the baseline for porting work.
Which tests to have before an Odoo upgrade
Before a major version move, the tests that matter most are the ones that catch silent breakage in the code you changed: overridden methods, inherited views, record rules and access groups, report rendering and a short set of key user tours. Odoo's upgrade service produces an upgraded test database, and that copy is where these tests should run before anyone signs off on production. Major upgrades on Odoo Online and Odoo.sh are mandatory every two years, so the suite should be treated as a standing asset, not a one-off project. Confirm with your hosting type which upgrade path applies to your database, since the Enterprise upgrade service requires an Enterprise subscription and Community installs follow a different route.
Start with the overrides. Every super() call in an overridden method and every inherited view that uses XPath should have at least one test that exercises the base behavior it depends on, because those are the points where a new core version most often changes a field, a method signature or a view structure. Next, write tests that log in as each relevant user group and confirm that record rules still hide or show the right records, and that a user without a group cannot reach the restricted action. Access failures rarely raise errors; they just return empty lists, so assert on the records returned, not only on the absence of an exception.
Add a rendering check for every custom PDF report, such as an invoice layout or delivery slip, and compare the generated output against an expected structure rather than pixel-matching it. Finally, record a small set of Odoo tours for the workflows the business cannot lose, such as quoting to invoicing or a warehouse receipt, and run them on the upgraded test database as part of the upgrade acceptance. Ask your partner or internal team to document which tests passed on the upgraded copy, which were skipped, and who owns fixing each failure, because that record is what turns a passing run into evidence for the upgrade decision.
Questions buyers ask about testing custom Odoo code
What drives the effort to build a test suite for custom Odoo modules?
The main driver is how much custom behavior the modules change and how many standard Odoo flows they touch. Each override of sales, inventory or accounting logic needs unit tests that cover the normal path, the edge cases and the failure paths. Front-end changes add JavaScript tests and tours that click through the screens users actually work in. Effort also rises with the number of companies, currencies, tax setups and user groups the tests must represent, and with how much test data has to be built by hand. Ask any partner to break the estimate down by module, test type and data setup, so you can see which parts are driving the cost.
Can our in-house team write Odoo tests without outside help?
Yes, if your developers already know Python, the Odoo ORM and the test framework that ships with Odoo. Writing TransactionCase unit tests for model logic is a routine skill for a developer who has built custom modules. JavaScript tests and tours need knowledge of the Owl web client, which is a narrower skill set. The usual gap is not the tests themselves but the test strategy: deciding what must be covered before an upgrade, setting up a repeatable database for CI, and keeping the suite passing as standard modules change. An outside team can help set that up, then hand the suite and its conventions to your staff.
What does the work need from our team?
Expect to provide access to the custom module repositories, the version your modules target, and a clear list of the business processes each module changes. Test data matters: realistic but anonymized records, sample products, partners, taxes and chart of accounts structures are needed so the tests reflect how your company trades. If you use a copy of production for testing, your team should follow the on-premise guidance on database duplication and neutralization so no live data or outgoing email reaches the test environment. You will also need a place to run the tests, such as a CI runner or an Odoo.sh build, and named people who can answer questions about business rules during the work.
How long does a testing project take for a small or large module set?
Duration depends on module size, the number of business flows covered and how much test data must be created. A single small module with a few model overrides and one or two screens is a short piece of work. A large set of modules that changes sales, inventory, accounting and the web client needs a longer plan, with time for test data design, fixing bugs the tests reveal and wiring the suite into your build pipeline. No fixed duration applies to every project. Ask for a timeline that lists the modules, the test types for each one and the milestones, and check it against the upgrade date you are working toward.
Do we have to rewrite the tests at every Odoo upgrade?
Not usually in full, but some tests will need updates each time. Odoo has a documented support window: standard support covers the first three years after a major release, and major version upgrades are mandatory every two years on Odoo Online and Odoo.sh. Each upgrade can change model fields, view structure, JavaScript components and default behavior that your tests depend on. Tests that check your own business rules tend to survive with small changes, while tests that rely on internal view structure or client details break more often. Plan a time to run the suite against the upgraded test database before production, and budget for fixing failing tests as part of the upgrade work.
Which tests should we have in place before an upgrade?
Start with tests for the business rules that money, stock, tax or compliance depend on: pricing, tax computation, invoice posting, stock moves and any approval or access logic you added. Next, cover the custom code paths that override standard methods, since those are the most likely to break when Odoo changes the parent method. Add tours for the main user journeys, such as quotation to invoice or receipt to delivery, so a broken screen is caught before users see it. Finally, make sure the suite runs automatically on module install and in your CI or Odoo.sh builds, so failures show up on every change rather than only during the upgrade window.
Does running tests on module install slow down our deployments?
It can. Odoo can run a module's tests when the module is installed or updated, which catches broken code early but adds time to each install. Many teams run the full suite in CI or on a dedicated build and keep the install step lean for production. Test runs that touch a copy of the database also need the database to be neutralized so tests cannot send email or call external services. Confirm with your engineers how the test database is created, where test runs happen and which steps are blocked from reaching production.
Security and operational concerns for test environments
Test environments often hold copies of production data, run on infrastructure with weaker controls, and receive credentials from pipelines. The cards below cover the risks that connect a Odoo test suite to the rest of your estate, and the checks to agree before tests touch a database.
Neutralize production copies
A test database built from production carries customer records, bank details and employee data into a less controlled place. Odoo documents database duplication with neutralization for test copies, which disables outgoing email, scheduled actions and payment provider connections in the copy. Use that option for every copy that test runs touch, and confirm in your environment that neutralization disabled the integrations you expected. Keep a record of which copy was made, when, and by whom.
On-premise docsSeparate test accounts and secrets
Test users created by tests should not reuse real staff logins or shared administrator passwords. Store the passwords or API keys that test tours and integration tests need in your pipeline's secret store, scoped to the test database only. Rotate them on a fixed schedule and remove accounts that tests create when a run finishes. Ask whether any test account can reach production hosts or live payment credentials.
Credential handling in CI
Pipeline logs often capture environment variables, failed test output and database connection strings. Mask secrets in CI settings, avoid printing configuration files in test steps, and limit which branches and reviewers can read protected variables. Check that artifacts such as screenshots from failed tours do not include session cookies or customer data before they are shared with the wider team.
Isolate test runners from production
Test runners should sit in their own network segment with no route to production databases, mail servers or identity providers. Run the Odoo test command against an ephemeral PostgreSQL instance that the pipeline creates and destroys. Confirm that a runner cannot write to a production data directory, and that build agents are not shared with deployment jobs that hold production credentials.
Control who runs tests on copies
Someone who can start a test run against a database copy can often read every record in it. Decide which roles may trigger test runs on copies that still contain personal data, and log those runs. Where possible, prefer generated or anonymized fixtures for the bulk of your tests, and reserve copies for upgrade rehearsals that need real data shapes.
Retain and delete test artifacts
Test databases, dumps, logs and browser traces accumulate after each run and can outlive the approval that allowed their data to be copied. Set a retention period for each artifact type, delete dumps when the upgrade rehearsal ends, and check that backups of the CI system follow the same rules as production backups. Ask your compliance lead which data classes the test environment is allowed to hold.
Where to confirm current testing and upgrade behavior
Check the upgrade and support dates before you decide how much test coverage to build, because they set how long your custom modules must keep working. Odoo's Odoo upgrade documentation explains how a database moves to a newer supported version through an upgraded test database, which is the copy your test suite should run against before production. Read it for the version you run today and for the version you plan to reach, and confirm which upgrade path applies to your hosting type.
Then confirm the deadlines in the Odoo standard and extended support documentation. It covers the window after a major release in which security updates and bug fixes are provided, and it states which paid extended options exist for each hosting type. Note that security patches are only provided during standard support, and that SaaS versions do not qualify for extended support. Record the end date for your version in your upgrade plan, and ask your partner or Odoo contact to confirm any date that falls close to your go-live or porting schedule.
Treat both pages as the reference for the version-specific assumptions in your test plan, such as which APIs your tests depend on and when your next forced upgrade will arrive. Recheck them at the start of each upgrade project, because the release calendar and support windows change over time, and any figure written into your internal runbook should carry the date it was confirmed.
How DeployOpen scopes and delivers Odoo test suites
DeployOpen scopes test work for custom Odoo modules under a fixed-scope agreement, so the list of modules, test types and deliverables is agreed in writing before any test code is written. For a test suite, the scope should name each custom module, the model and view behavior it covers, the JavaScript and tour flows included, the CI or Odoo.sh build that runs the tests, and who receives the results. Ask for the written scope to state what is excluded as well, such as existing standard Odoo behavior that will not be retested. Timelines and deliverables follow from that document, so review them with your development lead before signing.
DeployOpen implements and hardens self-hosted Odoo inside your own infrastructure, whether that is your cloud accounts, data centers or an air-gapped network. The test suite runs in the same environment as your build pipeline, against databases and secrets you control, so confirm early where test databases will be created, who can read the duplicated data, and how neutralized copies are handled. Ask the partner to show which runner executes the tests and where the results are stored.
Testing does not end at delivery. Ongoing testing and upgrade support are available as retainers, which is the usual route when a team expects to run the suite through several Odoo releases. Before agreeing to a retainer, confirm which tests will be updated at each upgrade, who owns failing tests after a version change, and how the retainer hours are reported. DeployOpen does not hold certifications or partner status for Odoo, so check any credentials a partner claims against the vendor's own listings.

