Articles>Clicking everywhere in Odoo

Clicking everywhere in Odoo

An interesting method for interface testing

Written by
Holden Rehg
Posted on
July 1, 2019

Typically, good software developers write tests.

But there are a lot of types of tests. With lots of different names depending on your software background.

One common type of test out there allows developers to interact directly with the GUI (graphical user interface) that a standard user would interact with, except in an automated way. Some people call these functional tests, or user interface testing or browser tests.

Either way, the developer could hypothetically write a test like:


class BrowserTest:
    def test_landing_page_has_login_button(self):
        self.go_to("/landing")
        self.assert_has("#login").redirects_to("/login")
        

Warning: That code above doesn’t have anything to do with Odoo, just more of a pseudo-code example of what a browser test would look like in a standard system.

In Odoo land, they use Tours to run these sort of tests. Tours run on PhantomJS, a headless browser, which allows you to interact with the interface through code, but also see the backend result.

Outside of Odoo, you will often see Python developers using a tool called Selenium which gives you the same sort of functionality. Selenium can be run against most browsers, headless or not, as well as tools like PhantomJS or BrowserStack.

But in the latest version of Odoo (12.0), there is a built-in feature that is great for running a test to ensure that the majority of the interface works as expected (or at least doesn’t error out.) This is something called the Click Everywhere Test. Wondering what it does? Well. It clicks everywhere. And then stops if there is an error or traceback.

  1. Activate developer mode
  2. Click the debug menu icon in the top right
  3. Click “Run Click Everywhere Test”
  4. Watch the screen jump around as the system automatically tries to click all available links and buttons 🙈

This isn’t as targeted or focused as a browser test that looks for a specific use case to pass, but it’s not a bad sanity check to ensure that there’s nothing obviously broken on the instance. This can save you some stress by preventing clients from becoming confused or angry because they happened to click a bad link somewhere on their instance and a traceback popped up.

Go give it a shot.

Thanks For Reading

I appreciate you taking the time to read any of my articles. If you're looking for more ramblings, take a look at theentire catalog of articles I've written. Or feel free to give me a follow on Twitter, Instagram, or Github to see what else I've got going on. Or see my contact info below if you want to get in touch with me.

odoo
software testing
erp
web development
python
Share:

Holden Rehg, Author

Posted July 1, 2019

Other articles you might like