Cross-browser-distributed testing

Exclusive offer: get 50% off this eBook here
Instant Testing with QUnit [Instant]

Instant Testing with QUnit [Instant] — Save 50%

Employ QUnit to increase your efficiency when testing JavaScript code with this book and ebook

$19.99    $10.00
by Dmitry Sheiko | September 2013 | Open Source

This article by Dmitry Sheiko the author of Instant Testing with QUnit will guide you on automating client-side cross-platform/browser testing using the command-line tool Bunyip.

(For more resources related to this topic, see here.)

Getting ready

In contrast to the server-side software, JavaScript applications are being executed on the client side and therefore depend on the user browser. Normally, project specification includes the list of the browsers and platforms that the application must support. The longer the list, the harder is cross-browser-compatibility testing. For example, jQuery supports 13 browsers on different platforms. The project is fully tested in every declared environment with every single commit. That is possible thanks to the distributed testing tool TestSwarm (swarm.jquery.org). You may also hear of other tools such as Js TestDriver (code.google.com/p/js-test-driver) or Karma (karma-runner.github.io). We will take Bunyip (https://github.com/ryanseddon/bunyip) as it has swiftly been gaining popularity recently.

How does it work? You launch the tool for a test runner HTML and it provides the connect end-point (IP:port) and launches a locally installed browser, if configured. As soon as you fire up the address in a browser, the client is captured by Bunyip and the connection is established. With your confirmation, Bunyip runs the tests in every connected browser to collect and report results. See the following figure:

Bunyip is built on top of the Yeti tool (www.yeti.cx) that works with YUI Test, QUnit, Mocha, Jasmine, or DOH. Bunyip can be used in conjunction with BrowserStack. So, with a paid account at BrowserStack (www.browserstack.com), you can make Bunyip run your tests on hundreds of remotely hosted browsers.

To install the tool, type in the console as follows:

npm install -g bunyip

Here, we recourse to the Node.js package manager that is part of Node.js. So if you don't have Node.js installed, find the installation instructions on the following page:

https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Now, we are ready to start using Bunyip.

How to do it

  1. Add to the QUnit test suite (test-suite.html) the following configuration option to prevent it from auto-starting before the plugin callback is set up:

    if (QUnit && QUnit.config) {
    QUnit.config.autostart = false;
    }

  2. Launch a Yeti hub on port 9000 (default configuration) and use test-suite.html.

    bunyip -f test-suite.html

  3. Copy the connector address (for example, http://127.0.0.1:9000) from the output and fire it up in diverse browsers. You can use Oracle VirtualBox (www.virtualbox.org) to launch browsers in virtual machines set up on every platform you need.
  4. Examine the results shown in the following screenshot:

Summary

In this article, we learnt about Cross-browser-distributed testing and the automation of client-side cross-platform/browser testing.

Resources for Article:


Further resources on this subject:


Instant Testing with QUnit [Instant] Employ QUnit to increase your efficiency when testing JavaScript code with this book and ebook
Published: August 2013
eBook Price: $19.99
See more
Select your format and quantity:

About the Author :


Dmitry Sheiko

Dmitry Sheiko is a web developer, blogger, and open source contributor living and working in the city of Frankfurt am Main, Germany. He started learning about computer programming in the late 80s. Since the late 90s, he has been developing web applications and tools. He currently works as a senior web developer for a leading game development company called Crytek GmbH. This is Dmitry’s first book, but he has been blogging for a decade. You can find his thoughts and solutions on subjects such as code quality, software architecture, JavaScript, NodeJs, TypeScript, HTML5 API, CSS3, and PHP at http://www.dsheiko.com.

Dmitry’s very first open source contribution was BCWB – an XSLT-based CMS in 2004. Since then, he has been contributing quite consistently. His latest works are available at https://github.com/dsheiko

Books From Packt


JavaScript Unit Testing
JavaScript Unit Testing

jQuery UI 1.8: The User Interface Library for jQuery
jQuery UI 1.8: The User Interface Library for jQuery

jQuery Hotshot
jQuery Hotshot

Learning jQuery, Third Edition
Learning jQuery, Third Edition

Learning jQuery - Fourth Edition
Learning jQuery - Fourth Edition

jQuery UI Cookbook
jQuery UI Cookbook

Instant jQuery UI Starter [Instant]
Instant jQuery UI Starter [Instant]

Using Node.js for UI Testing
Using Node.js for UI Testing


No votes yet

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
X
B
6
Y
K
L
Enter the code without spaces and pay attention to upper/lower case.
Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software