Engineering

How to Choose an Automation Framework

How to Choose an Automation Framework

It's pretty common to use automated tests to enhance the quality and speed of any project you may be working on. But often the right question is: which framework is better for my project?

Choosing the right framework is not a one-size-fits-all solution. You have to look at the various factors and project requirements to ensure you implement a framework that leads to an efficient result. I’ve weighed the pros and cons of each framework below to enable you to make an informed decision for yourself and your project.

The Comparison:

Protractor

  • Pros
    • Inbuilt support for AngularJS element identification strategies. It’s better to go with a protractor if the application is developed using AngularJS
    • It has support for different unit test frameworks like (Jasmine, Mocha, Cucumber, etc.)
    • A good reporting mechanism (HTML, XML, etc.)
    • Compatible with Continuous Integration
    • TypeScript support is available, which will help Angular 2 developers to write unit tests very easily
  • Cons
    • It does not have support to automate mobile apps
    • It is implemented as a wrapper to the WebDriverJS, which means one more layer is added between the Selenium server and the Protractor. If there is an issue with WebDriverJS, the Protractor team should wait for the WebDriverJS team to fix that issue

WebDriverIO

  • Pros
    • WebDriverIO is a custom implementation of the W3C WebDriver API. This gives it an edge to have complete control over implementation rather than depending on WebDriverJS implementation
    • It is fully extensible and is written to be as flexible and framework-agnostic as possible. It can be applied in any context and serves not only the purpose of testing
    • It has a command-line interface, ‘wdio,’ which makes test configuration as straightforward as possible so that a non-programmer can configure the setup
    • It has support for most BDD and TDD test frameworks
    • It has good support and an enthusiastic developer community, giving it an edge over NightwatchJS
    • It can be used with ‘webdriverCSS’ to compare the CSS stylings of an element on the webpage
  • Cons
    • Since it is a custom implementation, it is also a disadvantage as it deviates from generic syntax, which may confuse selenium developers from other languages
    • It can be used for automating AngularJS apps, but it is not as customized as Protractor

NightwatchJS

  • Pros
    • Like WebDriverIO, it is also a custom implementation of W3C WebDriver API
    • Like all other JS libraries, it is easily extensible. You can write custom commands and extend assertions
    • Its testing framework and assertions mechanism solve the programmer’s headache of choosing a testing framework
  • Cons
    • It does not have many unit test frameworks as it has its testing framework and supports Mocha
    • Slightly lesser support than WebDriverIO and Protractor

TestCafe

  • Pros
    • 1-minute setup
    • Web mobile supported
    • Device emulator
    • Multiple in-built selector strategies (React, Angular, AngularJS, Vue, Aurelia)
    • Set test speed
    • Compatible with Continuous Integration
    • Typescript support
  • Cons
    • Multi-tab, multi-window not supported
    • No support for mobile native apps
    • Unable to set Explicit waits

As you can see, there is not an easy answer for which is the best automation framework. But I’m sure you can find the best fit for your project. I hope this document will help you choose the one that matches your requirements best.

Ready To Start?

These are proofs of concept using the Page Object Model architecture implementation-specific for each framework, basically, plug and play. Please feel free to download the following Github repositories and play with the different frameworks so you can see the difference between them. You can also fork it and start with your project or playground. Let’s do it!

Written by Edgar Figueroa, Senior Software QA Engineer at Wizeline
Written by Edgar Figueroa, Senior Software QA Engineer at Wizeline

Nellie Luna

Posted by Nellie Luna on December 11, 2019