July 1, 2016

Hackweek 14 at SUSE

For those of you who doesn’t know what’s Hackweek thing is all about, please go here

During Hackweek #14 at SUSE I’ve got my hands dirty with automation testing. Long story short: we’re spending a lot of time on web-application tests in cloud QAM team at SUSE. We need to run all tests basically twice: before and after each update and, let’s be honest with ourselves here: it’s boring.

So I decided to automate all this stuff in Python because I’ve spent a lot of time with this programming language in the last couple of months.

I chose Crowbar web-interface page as an object of my testing. I tried to find a really simple and not verbose (like Selenium) library to imitate user’s interaction with a web page. During my research I found out that Splinter library is the best choice for my goal.

And here why I think so:

  • it’s open-source;
  • it’s really simple (see example below);
  • it supports multi web-drivers (chrome, firefox, phantomjs, zope.testbrowser);
  • it supports css and xpath selectors (which is really useful in my case);

So let’s compare a simple code: to fill out a form field with Splinter:

browser.fill('username', 'janedoe')

In Selenium, the equivalent code would be:

elem = browser.find_element.by_name('username')

So it’s simplicity vs verbosity, the choice is clear. So let’s get back to my project:

Gordon goals are:

  • to automate basic user actions in Crowbar web-interface;
  • to show user what’s going on in browser right now (with chrome browser);
  • to collect all results of testing in the end;
  • to finish at least POC during 5 days of hacking;

You can see a short animation of Gordon in action below:

Animation …and in the end the results are:

  • POC was created;
  • Gordon can simulate typical user behavior (drag & drop, form filling etc…) on the main Crowbar page;
  • ~60 tests were written.

here you can see a short presentation of the current Gordon state

So that’s it, pretty simple. You can see more information about Gorodn on it’s Github page

Creative Commons - Attribution, Noncommercial, No Derivative Works 3.0 License