Development Book V18: Tagged Python Test

To access fields that haven't been included in the view yet, click on the "Available Fields" option. This section lists all fields defined for the model but not currently shown. You can simply drag any of these fields into the layout to include them in the view.

The --test-tags option lets you choose which tests to execute from the command line. It implicitly enables testing, so you don’t need to add --test-enable when using --test-tags.

If you launch Odoo with --test-enable, it defaults to +standard, so all tests labeled standard (whether explicitly or by inheritance) will run automatically.

Example command for executing test cases with --test-tags

                       odoo-bin --test-tags [-][tag][/module][:class][.method]

The leading - determines whether to exclude (rather than include) tests matching the spec. The spec itself corresponds to tags applied via the @tagged() decorator on a test class, and using * will match every tag.

Example:

To run tests for particular tags, you might use a command like:

                       odoo-bin --test-tags=standard,external

The --test-tags switch accepts both + (include) and - (exclude) prefixes. A - prefix will remove that tag from the selection—even if other tags would otherwise include it. For example, to execute all standard tests except those also tagged external, you could write:

                       odoo-bin --test-tags 'standard,-slow'

Testing an entire module:

                       odoo-bin --test-tags=/sale

Running a single test method:

                       odoo-bin --test-tags=.test_currency_post

Runs only the test_currency_post function.

Module tests minus a specific tag:

                       odoo-bin --test-tags='/sale,-slow'

Executes all sales module tests except those marked as slow.

Module or tag-based test:

odoo-bin --test-tags='-standard,external,/sale'

Runs tests in the sale module or any tests tagged external, while excluding the default standard tests.

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message