I am trying to write test cases in odoo 8, but i am unable to run the test cases. I mean nothing happens, no test case runs. I have created a module and below is my code.
__openerp__.py
{
'name': "wms_mobile",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "Your Company",
'website': "http://www.yourcompany.com",
'category': 'Uncategorized',
'version': '0.2',
# any module necessary for this one to work correctly
'depends': ['web'],
# always loaded
'data': ['views/main_templates.xml'],
# only loaded in demonstration mode
'demo': [
'demo.xml',
],
}
and i have tests folder with __init__.py and test_location.py __init__.py
# -*- coding: utf-8 -*-
from . import test_location
test_location.py
# -*- coding: utf-8 -*-
from openerp.tests.common import TransactionCase
class test_location(TransactionCase):
def setUp(self):
super(test_location, self).setUp()
self.LocationObj = self.env['stock.location']
def test_location(self):
record = self.LocationObj.search([('name','=','Stock')])
self.assertEqual(record.id,1)
I run the server with --test-enable parameter, But i don't see the test running.
Am I missing Something.
My database has entries also.
Please Help
Thanks,
You also have to specify the database...(you have to create a test db, so you don't mess up the real db) you want to run the tests on, and optionally the module you want to test, you should also set log-level
to test to get a more verbose output
./odoo.py -c /path/to/configfile.conf -d dbname -u yourmodule --log-level=test --test-enable