Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
19858 มุมมอง

OpenERP uses a python testing framework; based on unittest2. For more information: https://doc.openerp.com/trunk/server/05_test_framework/

 

My question is the following: How to start/invoke these tests?

I created a structure with a 'tests/' folder and a single `openerp.tests.common.TransactionCase`.

But what to do next if you're not running with the openerp-command project?

 

 

EDIT:

After studying some server code: it seems that tests are launched from `load_module_graph()`. Although this doesn't have to be the ONLY point of entry! In this case, it also shows that:

  • you need to update (-u) the module that needs testing 
  • the module should also contain demo data.
    • If a module is already installed without demo data, you should set the demo boolean to True in ir.module.module.
  • that you should start the server with `--test-enable`

Rephrased question: Are there other ways to launch module tests besides launching a server with demo-data?

I'm also curious on how to display results in Eclipse's PyUnit. But thats another topic I'm afraid.

 

EDIT 2:

This is what the documentation 

To run the tests .. the simplest way is to use the oe command (provided by the openerp-command project).

points to: http://bazaar.launchpad.net/~openerp/openerp-command/trunk/view/191/openerpcommand/run_tests.py

 

EDIT 3:

https://www.odoo.com/forum/Help-1/question/How-to-run-tests-526

 

EDIT 4:

In the mean time, OpenERP seems to have included some documentation in their how-to's:

https://www.odoo.com/forum/how-to/Developers-13/How-to-run-tests-526

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

https://apps.odoo.com/apps/modules/15.0/odoo_tests/

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

There's a really nice pytest plugin, made to run unit tests with pytest. Have a look at this SO answer: http://stackoverflow.com/a/41862286/2498426

In short: install the plugin, create a config file, and run pytest.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
run single unit test case แก้ไขแล้ว
1
ม.ค. 24
14301
How to run tests แก้ไขแล้ว
4
เม.ย. 23
45856
0
เม.ย. 15
4371
Why native test fails? แก้ไขแล้ว
2
มิ.ย. 20
6483
1
พ.ค. 20
3225