Python AutotestsΒΆ

To add tests you need:

  • Create folder named tests

  • Add file

  • Create a file whose name starts with test_ (put corresponding import to file from the previous step)

  • Add new Class based on one of test cases

  • Add test methods whose names start with test_


you shall NOT import tests in module folder, i.e. do NOT add from . import tests to main file


from odoo.tests.common import TransactionCase

class TestMessage(TransactionCase):
    at_install = True
    post_install = True

    def test_count(self):
        expected_value = self.do_something()
        actual_value = self.get_value()
        self.assertEqual(expected_value, actual_value)

    def do_something(self):