Skip to Content
Menu
This question has been flagged
1 Odpoveď
14385 Zobrazenia

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?

Avatar
Zrušiť
Autor Best Answer

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

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
máj 22
19957
2
jún 20
6568
1
máj 20
3261
0
nov 19
4342
1
nov 19
6726