How to run Odoo tests unittest2?

怎甘沉沦 提交于 2019-12-10 10:36:39

问题


I tried running odoo tests using --test-enable, but it won't work. I have a couple of questions.

According to the documentation Tests can only be run during module installation, what happens when we add functionality and then want to run tests?

Is it possible to run tests from IDE like Pycharm ?


回答1:


@aftab You need add log-level please see below.

./odoo.py -d <dbname> --test-enable --log-level=test

and regarding you question, If you are making changes to installed modules and need to re test all test cases then you need to simple restart you server with -u <module_name> or -u all(for all modules) with the above command.




回答2:


This useful For Run odoo test case:

./odoo.py -i/-u module_being_tested -d being_used_to_test --test-enable

Common options:

 -i INIT, --init=INIT
       install one or more modules (comma-separated list, use "all" for all modules), requires -d

-u UPDATE, --update=UPDATE
       update one or more modules (comma-separated list, use "all" for all modules). Requires -d.

Database related options:

-d DB_NAME, --database=DB_NAME
       specify the database name

Testing Configuration:

 --test-enable:  Enable YAML and unit tests.



回答3:


Here is a REALLY nice plugin to run unit odoo tests directly with pytest:

https://github.com/camptocamp/pytest-odoo

Here's a result example:



来源:https://stackoverflow.com/questions/34445394/how-to-run-odoo-tests-unittest2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!