Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
14295 Widoki

I wish all of you a happy new year! I want to write more unit tests in the new year, but how to handle it more easily? I found out to run tests while updating a module via --test-enable and --stop-after-init command line parameters. I have also read about --test-file parameter, but it does not work. This parameter is also not described in the docs.

How would you do TDD (test driven development)? In order to do that you have to be able to run tests quickly. Requiring to test the whole module with all its dependencies makes it impractical to write tests frequently. How to run a single unit test case?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

My solution so far:

python ./odoo.py -i module_to_test --log-level=test -d minimal_database --test-enable --stop-after-init

This is pretty common advice

However, the solution seems to be not to use the --test-file parameter, since this unexpectedly runs all tests of all dependent modules and does whatever else, making it too long to execute.

Another part of the solution is to use a minimal database where just the module to be tested plus its dependencies of course is installed.

Now the above command takes only several seconds to execute at my machine even if the tested code uses objects from dependent modules. If only I could prevent the module to make an update each time while running the tests in order to make it even faster and more efficient ...

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 22
19855
2
cze 20
6483
1
maj 20
3225
0
lis 19
4293
1
lis 19
6642