Test Automation Toolbox 2019

javaccriptWebdriverIOtest automation

What tools to use for browser based automation in 2019?

More and more websites are moving into building their front-end and and in some cases in the backend in JavaScript. Frameworks like React, Angular and Vue.js are taking building web user interfaces to a new level in terms of functionality and being dynamic. Using these frameworks brings with them unit test frameworks, which are naturally written in JavaScript too. Having this whole ecosystem of JavaScript tools has to be a factor when choosing the test framework for functional/acceptance testing as well. When the team is building the site or app in JS, there are clear benefits in implementing the tests in the same language. Where do you go if there is a difficult programming problem? In most case it would be easiest to just talk to one of the developers as they typically have more experience and deeper knowledge of the language.

JavaScript is also where a lot of the innovation happens now in terms of web development. This is partly caused by the fact that it is the only language that runs in a browser and there is really no alternative for doing the same things currently. This could change with WebAssembly in a couple of years.

Most of the browser automation tools use selenium to communicate with the browser but there are also tools that by-pass it by talking directly to the browser. Cypress.io and Puppeteer are such frameworks. They are faster and circumvent some of the problems related to Selenium. Both of these only support Chrome and they also do lack some of the tooling that has been built into frameworks such as WebdriverIO., which might be a showstopper for some projects.

WebdriverIO

WebdriverIO is one of the most popular tools when writing browser tests in JavaScript. It has a nice API and lots of useful integrations. These integrations come in three different specific areas:

  • test frameworks
  • services
  • reporters

I’ve used WebdriverIO for the past three years and have been quite happy with the results. There are big changes between v4 and v5 and anyone starting a new project right now should opt for the new version.

The Test Runner

WebdriverIO comes with its own test runner that does several things out of the box. For example, it can run tests in parallel and retry flaky tests. The full list of options is available in the docs.

Test Frameworks

WebdriverIO can be used with several popular test frameworks by just including an adapter in package.json and adding some configuration. The supported test frameworks are the following:

  • Mocha
  • Jasmine
  • Cucumber (currently only supported in v4)

Services

There are a number of services that can be integrated with by just adding the npm package to development dependencies and adding the service in the configuration. Usually the service can also be configured right in the WebdriverIO config file.

There are services for Browserstack and Sauce Labs, there is one for selenium-standalone and another one for Applitools. The full list is available in the Services section of the documentation.

Reporters

Another area that makes is easy to get started and later on work with WebdriverIO is the reporter integration. There are a number of different reporters available that work well out of the box. These are described in detail in the Reporter section of the documentation. The documentation is not an exhaustive list and there are other good reporters available, for example:

Summary

WebdriverIO with its integrations and extensibility have worked well in some recent projects and I consider it as a safe choice also in 2019. It is also a good time to start looking at tools like Cypress.io depending on the organisations needs.