-
Book Overview & Buying
-
Table Of Contents
Odoo Development Cookbook
By :
Odoo supports different ways of writing addon module tests, YAML tests, and Python tests. In this recipe, we will see how to write YAML tests for the my_module methods we wrote in Chapter 5, Basic Server Side Development, in the recipe Define Model methods and use the API decorators.
This recipe assumes you have an instance ready with the code for the my_module module defined in Chapter 3, Creating Odoo Modules, and the code from the Define Model methods and use the API decorators recipe in Chapter 5, Basic Server
Side Development.
In order to write YAML unit tests for my_module, you need to follow these steps:
Edit the __openerp__.py file of the module, and add the test's entry:
{ # … 'test': ['test/test_books.yml'] }
Create a test directory in my_module:
$ mkdir test
Create a file called test_books.yml in the directory. Add a test description at the top:
- Test LibraryBook.change_state
Add a step changing the current...