I have wrote unit test, that extends unittest2.TestCase (using unittest2 library). But now I cannot understand and find any information how to run. Please, help. OE version is 6.1
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
I found it! At first, add to __init__ of your module something like
import tests
Next, create package tests in your module. Example of it's __init__:
from . import test_hr
fast_suite = [test_hr, ]
test_hr - module in package with test classes (inherited from openerp.tests.common.TransactionCase)
Next: set in your OE config in [options] section:
test_enable = True
Finally, run tests with the following command:
openerp-server -c /path/to/config.conf -d dbname -u yourmodule --log-level=test
Have fun! Really to much undocumented condition for simple tests! I think OE developers never user it :).
I struggled somewhat myself with running test cases for odoo modules.
I created an open source shell script to run tests inside a docker container, for those interested:
https://github.com/dimitrydhondt/odoutils
It can be used in interactive mode, or in a (CI/CD) script.
Running tests
Tests are automatically run when installing or updating modules if --test-enable was enabled when starting the Odoo server.
https://www.odoo.com/documentation/15.0/developer/reference/addons/testing.html
there is a plugin for pytest that can run odoo tests. Check out this SO answer: http://stackoverflow.com/a/41862286/2498426
In short: install the plugin, create a config file, run pytest.
I have a demo database, I run openerp with --test-enable --log-level=test, I have a tests folder with an __init__.py file that import my tests files. I imported openerp.tests.common import TransactionCase and created proper tests (the name of the method begins with "test_"). However openerp do not run the tests when installing or updating.
In odoo 8 and newers versions I do the same and tests are run without any problem. What am I missing here?
Thank you!
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
0
dic 15
|
3870 | ||
|
1
ene 23
|
3881 | ||
|
0
oct 22
|
1511 | ||
|
0
ago 22
|
3 | ||
|
0
dic 21
|
51 |