Clicking everywhere in Odoo

An interesting method for interface testing

Holden Rehg
3 min readJul 1, 2019
Photo by Ricardo Resende on Unsplash

Update — Mar 1st, 2021

Hello! If you’ve seen my articles pop up in your searches before, I really appreciate the time people have taken to read my articles. At this point, there’s been over 75k views across the 25 or so articles I’ve written here on Medium. That’s amazing to me since writing is a hobby I started doing just to try to get a bit better at writing and communicating.

I wanted to let everyone who lands on these articles that I have migrated everything over to a self hosted blog (for a bunch of reasons that I won’t get into here). So please take a look at https://holdenrehg.com/blog for all of the articles or https://holdenrehg.com/blog/2019-07-01_clicking-everywhere-in-odoo to specifically see this article.

Thanks again! — Holden

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

Sign up for my new ERP project called Buster and let me know your thoughts.

🐦 Follow me on Twitter for random thoughts and articles about business software and software development.

📓 Follow me directly here at Medium to stay up to date with my articles.

📷 Follow me on Instagram if you want to see pictures of (mostly) food and bread that I cook.

Holden

--

--

Holden Rehg

🧑‍💻 Software Freelancer and Consultant | Works mostly with #odoo and #python web apps | Writes at http://holdenrehg.com/blog