Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

How to run unit test

By
veronika
on 10/1/13, 5:33 AM 5,242 views

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

1
duh386
On 11/14/13, 3:14 PM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 10/1/13, 5:33 AM
Seen: 5242 times
Last updated: 4/10/15, 10:46 AM