Adding client-side QUnit test cases
Building new fields or views is very simple in Odoo. In just a few lines of XML, you can define a new view. However, under the hood, it uses a lot of JavaScript. Modifying/adding new features on the client side is complex, and it might break a few things. Most client-side issues go unnoticed, as most errors are only displayed in the console. So, QUnit test cases are used in Odoo to check the correctness of different JavaScript components.
QUnit is a JavaScript testing framework primarily used for client-side testing. It’s commonly associated with testing JavaScript code in web applications, particularly for frontend development. QUnit is often used to test the logic and behavior of JavaScript functions, modules, and components in a web browser environment.
Getting ready
For this recipe, we will continue using the my_hostel
module from the previous recipe. We will add a QUnit test case for the int_color
widget.