Automated Interaction Testing For Major Web Browsers

To improve and accelerate Web sites and applications testing, developers often use a class of tools called “headless browsers”. These tools are used to test the behavior of web browsers automatically, without visualization.

The most popular headless browsers are currently PhantomJS for http://en.wikipedia.org/wiki/WebKit, the layout engine of Safari and Chrome, and SlimerJS for testing under Gecko, Firefox’s layout engine.

We can also use CasperJS to facilitate the creation of test scenarios with the PhantomJS JavaScript API. Here is a short demo on “Automating with PhantomJS and CasperJS” by Chris Hawkes:

 

Finally (drum roll please!), the development of a new tool for Trident – the layout engine of Internet Explorer – started on Github this fall. That is important to note because over 50% of desktops browsing the Web are still equipped with a version of Internet Explorer, from version 6 (4.92%) to version 10 (17 , 5%) inclusive. In fact, TrifleJS is another add-on to PhantomJS for the .NET Windows environment.

What does this mean for web developers?

With these tools we can now:

  • Create screenshot scripts to see our web projects rendering in each of these three layout engines;
  • Check all the links of a web project and make sure that there is no 30X/40X/50X errors (e.g. 300,404,501);
  • Create integration tests for complex forms with 10,000 field entries;
  • Create an army of robots grabbing all the images of cats on Imgur. 🙂

Please check this website again after the New Year if you’re interested. I will try to set up a short demonstration and post it in my next blog post.