This is a guest blog post by Will Iverson, David Drake, Osama Khalaf, and Adam Herbst of Dynacron Group, a technology consulting firm based outside Seattle that provides software development (Java/.NET) and BI/DW services based on Continuous Delivery.
Dynacron Group staff started working with Selenium nearly four years ago. The biggest problem we had was execution time – we had a limited number of browsers and during launches, test & release jobs would start to pile up as we were waiting for the limited browsers in our homebrew Selenium grid to be available.
To solve that problem for a new project we started almost a year and a half ago, we decided to use Sauce Labs. To make it as easy as possible for the test team, we created a parallel execution framework to make it dead easy to run the tests, and a template project to make it dead simple to get started.
By standardizing the parallel execution framework and template project, a tester can pretty much just sign up with Sauce Labs, follow a few basic configuration steps, and start writing test suites that leverage parallel execution in no time. Most people start with the Selenium Recorder, just pasting commands in from the clipboard to start and then pretty quickly graduate to just writing stuff in their IDE of choice.
Let me explain why parallel execution is so cool: we write 200 tests. We run those tests in parallel across five browsers (Firefox, Chrome, Safari, and two versions of Internet Explorer). That’s a thousand tests. If we ran those serially, one after the other, it would take the better part of a day. By running fifty parallel browsers, we can finish that test suite in fifteen minutes.
The Sauce Labs site can give you an overview of the other awesome features (recording video of every job, step-by-step screenshots, and Sauce Connect to name a few) – but nothing is as nice for us as the time-to-market advantage.
For more information, check out:
Just download this tutorial and follow the instructions to get started.
Webtest Quickstart is the template project. This is where you’ll want to go to get started quickly.
If you’re just starting on a new Selenium test project, you might consider using JUnit to manage your test cases. The webtest-quickstart project can provide a simple starting point for importing your IDE tests into JUnit and running them in maven.
To get started, just download the the webtest-quickstart project from github, or use the maven archetype from the same site. Inside the project, you’ll find sample test cases for many different testing situations. There are samples for running tests against a site running on your computer, or against websites on your network. Best of all, the parallel-webtest library gives you the ability to easily configure how tests are run. The project pom has sample profiles for running your tests in your own browser or in several different Sauce browsers in parallel, all from the same test code.
Parallel Webtest is the library that handles the parallel execution & configuration.
At its heart is a JUnit base test class that manages the browser lifecycle. It configures and launches the browser before executing a test class, and cleans it up afterwards. This isolates the test code, promoting cleaner test methods. Browser selection and parallel configuration are handled with a few configurable system properties; the same test code can be run in serial or parallel, locally or remotely, against one browser type or many. As a result, a test suite that once took four hours to run can be finished in as little as fifteen minutes using the same build server.
The webtest-quickstart and webtest-quickstart-archetype are open-source. Both are available on Dynacron Group’s Github account. If you have a chance to try it out, let us know what you think at email@example.com. And happy (faster) testing!