Writing tests for client side code
The more code you have on the client side, the more it becomes a liability. For server side code, there's the well-entrenched unit tests, and for JavaScript, we have QUnit (https://qunitjs.com), which Odoo uses.
Getting ready
We'll add our tests to the addon developed in the previous recipes, so grab the code from the recipe Making RPC calls to the server and put it in a new module called ch15_r04
.
How to do it...
We have to add our test file and make it known to the test mechanism in the appropriate template.
- Add the
static/test/ch15_r04.js
file:odoo.define_section('ch15_r04', ['ch15_r04'], function (test, mock) { test('FieldMany2OneButtons', function(assert, ch15_r04) {
- Create a minimal implementation of
FieldManager ...
Get Odoo Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.