diff --git a/content/developer/howtos/rdtraining/E_unittest.rst b/content/developer/howtos/rdtraining/E_unittest.rst index f17a8bc9f..4a4836520 100644 --- a/content/developer/howtos/rdtraining/E_unittest.rst +++ b/content/developer/howtos/rdtraining/E_unittest.rst @@ -42,19 +42,25 @@ Before knowing how to write tests, we need to know how to run them. Launch a python test file. --test-enable Enable unit tests. --test-tags=TEST_TAGS - Comma-separated list of spec to filter which tests to - execute. Enable unit tests if set. - A filter spec has the format: - [-][tag][/module][:class][.method] - The '-' specifies if we want to include or exclude - tests matching this spec. The - tag will match tags added on a class with a @tagged - decorator. By default tag value is 'standard' when not - given on include mode. '*' will match all tags. Tag - will also match module name (deprecated, use /module) - The module, class, and method will respectively match - the module name, test class name and test method name. - examples: :TestClass.test_func,/test_module,external + Comma-separated list of specs to filter which tests to + execute. Enable unit tests if set. A filter spec has + the format: [-][tag][/module][:class][.method] The '-' + specifies if we want to include or exclude tests + matching this spec. The tag will match tags added on a + class with a @tagged decorator (all Test classes have + 'standard' and 'at_install' tags until explicitly + removed, see the decorator documentation). '*' will + match all tags. If tag is omitted on include mode, its + value is 'standard'. If tag is omitted on exclude + mode, its value is '*'. The module, class, and method + will respectively match the module name, test class + name and test method name. Example: --test-tags + :TestClass.test_func,/test_module,external Filtering + and executing the tests happens twice: right after + each module installation/update and at the end of the + modules loading. At each stage tests are filtered by + --test-tags specs and additionally by dynamic specs + 'at_install' and 'post_install' correspondingly. --screencasts=DIR Screencasts will go in DIR/{db_name}/screencasts. --screenshots=DIR Screenshots will go in DIR/{db_name}/screenshots. Defaults to /tmp/odoo_tests. diff --git a/content/developer/reference/cmdline.rst b/content/developer/reference/cmdline.rst index f7df05c38..32e9ea142 100644 --- a/content/developer/reference/cmdline.rst +++ b/content/developer/reference/cmdline.rst @@ -54,11 +54,28 @@ Running the server .. option:: --test-enable - runs tests after installing modules + runs tests after module installation -.. option:: --test-tags 'tag_1,tag_2,...,-tag_n' +.. option:: --test-tags [-][tag][/module][:class][.method] - select the tests to run by using tags. + Comma-separated list of specs to filter which tests to execute. Enable unit tests if set. + + Example: `--test-tags :TestClass.test_func,/test_module,external` + + * The `-` specifies if we want to include or exclude tests matching this spec. + * The tag will match tags added on a class with a :func:`~odoo.tests.common.tagged` decorator + (all :ref:`test classes ` have `standard` and `at_install` tags + until explicitly removed, see the decorator documentation). + * `*` will match all tags. + * If tag is omitted on include mode, its value is `standard`. + * If tag is omitted on exclude mode, its value is `*`. + * The module, class, and method will respectively match the module name, test class name and test method name. + + Filtering and executing the tests happens twice: right + after each module installation/update and at the end + of the modules loading. At each stage tests are filtered + by `--test-tags` specs and additionally by dynamic specs + `at_install` and `post_install` correspondingly. .. option:: --screenshots