Client-Side Test Cases
Odoo provides a way to run client-side test cases from the UI. By running the test case from the UI, you can see the behavior of each step of the test case. This way, you can be sure that your UI test cases work as intended.
Both QUnit test cases and Tours test cases can be run from the UI. Python test cases run server-side and cannot be run from the UI. Developer mode must be enabled to see options for running test cases through the user interface.
Running QUnit test cases from the UI
Enable developer mode, click the bug icon, and click the Run JS Tests option.
This will open the QUnit suite and run the test cases one by one, as shown in the screenshot below. By default, only failed test cases are shown. To see all passed test cases, clear the Hide passed tests check box, as shown in the screenshot below.
Running tours from the UI
Activate developer mode and click on the bug icon and then click on Start Tour:
This will open a dialog with a list of registered tours, as shown in the screenshot below. Click the play button on the side to start the tour.
Video/Screenshots For Failed Test Cases
Odoo uses headless Chrome. This opens up additional possibilities. Since Odoo 12, it is possible to record failed test cases and take screenshots of failed test cases.
Generating Video/Screenshots
Recording a video for the test case requires the ffmpeg package.
● Command to install ffmpeg package in python
apt-get install ffmpeg
● If you want to generate screencasts (videos) of your test cases, use the --screencasts command:
./odoo-bin -c server.conf -i my_module --test-enable
--screencasts=/home/odoo/odoo_test/
● If you want to take screenshots of your test cases, use the --screenshosts command :
./odoo-bin -c server.conf -i my_module --test-enable
--screenshots=/home/odoo/odoo_test/
To create screenshots/screencasts of failed tests, you need to run the server with a path where you store video or image recordings. Every time you run a test and the test fails, Odoo saves a screen capture/video of the failed test case to the specified registry.
To generate test case videos, Odoo uses the ffmpeg package. If this package is not installed on the server, it will only save screenshots of failed test cases. After installing the package, you will see mp4 files of all failed test cases.