Search code examples
unit-testingodoo-10

unit test cases for wizard in odoo 10


I am new to Odoo. I am using Odoo 10. I would like to write test cases for a new wizard I created under a module A. I put all my wizard code (views + models) inside wizards directory. I created unit test cases under the path <<module/tests>> followed all the file/class/method naming conventions. When I try to upgrade the module (with test enable) to run unit test cases, all the other modules tests scripts are run but not for the newly created module A. Please suggest what additional changes might be needed to enable test scripts for a newly created module with wizard.

Thank you.


Solution

  • I believe that the structure you have follow is according to the standard way. You can find the structure here Testing Module Structure.

    Also please check that the naming on the folder and file in which you wrote the code,

    for example - tests/test_todo.py Also, don't forget to update the import in tests/init.py to from. import test_todo

    This is because Odoo expects the test module names to start with test_ when it searches for tests belonging to a module Code Reference

    Command to Run the testcases:

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