Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Odoo tests unittest2?

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 ?

like image 791
Aftab Naveed Avatar asked Jan 07 '23 23:01

Aftab Naveed


2 Answers

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.
like image 153
Jainik Patel Avatar answered Jan 13 '23 00:01

Jainik Patel


@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.

like image 37
Bazzinga... Avatar answered Jan 13 '23 00:01

Bazzinga...