Chapter 12 - Odoo 15 Development Book

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 will be able to see each step of the test case in action. This way, you can verify that the UI test case is working exactly as we wanted.

You can run both the QUnit test case and the tours test case from the UI. It is not possible to run Python test cases from the UI as it runs on the server-side. In order to see the options to run test cases from the UI, you need to enable developer mode.

Running QUnit test cases from the UI

Activate developer mode and click on the bug icon and Click on the Run JS Tests option:

odoo-development-book

This will open the QUnit suite and it will start running the test cases one by one, as shown in the following screenshot. By default, it will only show failed test cases. To show all the passed test cases, uncheck the Hide passed tests checkbox, as shown in the following screenshot:

odoo-development-book

Running tours from the UI

Activate developer mode and click on the bug icon and then click on Start Tour:

odoo-development-book

This will open the dialog with a list of registered tours, as you can see in the following screenshot. Click on the play button on the side to run the tour:

odoo-development-book

Video/Screenshots For Failed Test Cases

Odoo uses Headless Chrome. This opens additional opportunities. Beginning from Odoo 12, you can record recordings of the failed test cases, or you can take screen captures of the failed test cases too.

Generating Video/Screenshots

Recording a video for the test case requires ffmpeg package.

  • Command to install ffmpeg package in python
  • apt-get install ffmpeg
  • If you want to generate screencast (video) of a test case, use the --screencasts command:
  • ./odoo-bin -c server.conf -i my_module --test-enable
     	--screencasts=/home/odoo/odoo_test/
  • If you want to generate screenshots of a test case, use the --screenshosts command:
  • ./odoo-bin -c server.conf -i my_module --test-enable
    --screenshots=/home/odoo/odoo_test/

To produce screen captures/screencasts for the failed tests, you want to run the server with the path to save the video or picture records. Whenever you run the test, and if a test falls, Odoo will save a screen capture/video of the failed test case in the given registry.

To generate a video of a test case, Odoo uses the ffmpeg package. If you haven't installed this package on the server, then it will only save a screenshot of a failed test case. After installing the package, you will be able to see the mp4 file of any failed test case.

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message