Testing is a cycle through which we can guarantee the usefulness and nature of our modules or code. With testing, we can guarantee that the framework meets the prerequisites that guided its plan and improvement. In Odoo, they are giving a few highlights for testing the modules inside it. We can just compose the experiments and guarantee the right usefulness. There are a few focuses we need to consider prior to composing an experiment. In this blog, we will talk about the various strides for composing an experiment in Odoo.
To start with, we will examine the construction of test cases.
In order to write a test case in odoo, we have to make a sub folder, ‘test’ in our module and import it inside your_module/__init__.py. Inside the ‘test’ index, we can characterize your test case utilising python libraries. The order ought to resemble the accompanying.
Note that the tests which are not imported in your_module/tests/__init__.py won’t be executed.
And inside the __init__.py
from . import test_bar,test_foo
odoo.tests.common.TransactionCase #Most common
odoo.tests.common.SingleTransactionCase
odoo.tests.common.HttpCase
odoo.tests.common.SavepointCase
# -*- coding: utf-8 -*-
from odoo.tests import TransactionCase
class MyTests(TransactionCase):
...
--test-enable