The Top 8 Essential JavaScript Automation Frameworks

JavaScript Automation Framework
Automation Guild Online Conference Top ad

The Top 8 Essential JavaScript Automation Frameworks

There has been explosive growth in JavaScript Framework usage over the past few years. You might ask why? I believe that one of the main reasons for this is that there are a lot more web applications that are now using technology like AngularJs and React, so of course this is giving rise to many more JavaScript developers in the field.

At a high level here are the top javascript automation frameworks. More detail for each framework can be found below

  • PhantomJS

  • Jasmine

  • Protractor

  • Nightwatch.js

  • CasperJS

  • Nemo.js

  • Buster.JS

  • DalekJS

Shift Left Test Automation Javascript

Most companies are also making a test-first, shift-left move in their development practices due to a larger demand from developers who want to create their own tests in the language they are most familiar with: JavaScript.

Many front end developers and programmers also want to create their own automated tests to get quick feedback on whether or not they’ve broken a code in their application while checking in new code or make changes to the exiting code base.

I'n my last post I showed you what the top six general Open Source Test Automation Frameworks You Need to Know but what are the top JavaScript Automation Frameworks?

More JavaScript Automation Frameworks Options

If you’re into test automation how does this affect you? Well, I had a conversation with Moshe Milman from Applitools last year at a testing conference, and he confirmed that more and more companies are starting to implement JavaScript-based automation frameworks.

Ever since then, I’ve been hearing more and more about JavaScript automation. Later during that same conference, I heard something similar from a developer at HP and was told that they believe in it; so much so that they were working on a JavaScript implementation of LeanFT.

The latest incident that really made me a believer in JavaScript Automation was an analysis done by Dave Haeffner which showed that in 2015 alone, JavaScript downloads for Selenium eclipsed all prior years combined.

What are the Top JavaScript Test Automation Frameworks?

Most of you are probably wondering what the top automaton frameworks for JavaScript actually are. Here’s what I found. I ranked the frameworks in order of popularity based on a combination of GitHub stars and NPM downloads numbers:

PhantomJs

1. PhantomJS

PhantomJS is a headless WebKit that is scriptable with JavaScript. It’s used mainly for unit level, front end testing and is easy to run from a command line so it integrates nicely with CI systems.

I spoke with Rob Friesel, author of PhantomJS Cookbook on TestTalks last year, and he said his main use of PhantomJs is to run a battery of unit test against code changes, so that as developers are committing new code, they quickly gain a high degree of confidence that the code they’re checking doesn’t have any effect on the current code base.


Because the testing is headless, the scripts run much faster than a traditional browser-based approach would.

This is a good practice; it’s great to use before your functional test scripts run, since they act as a quick and dirty sanity test to catch any issues before regression testing starts.

Based on some quick research I would say that PhantomJS is the most popular headless automation framework available at this time.

• 18,420 GitHub Stars
• 1,273,433 NPM downloads in the last month

Jasmine BDD

2. Jasmine

Jasmine is a behavior-driven JavaScript framework for testing JavaScript code. This is the “go to” unit testing framework for many developers, including Derick Bailey from watchmecode.net.

In my TestTalk with Derick, he mentioned that he knows it's not the most up-to-date framework out there; there are other frameworks that push forward faster and more frequently, but he’s not necessarily interested in staying on the cutting edge (or even the leading edge) of the testing world. Derick is more interested in long term stability, support and simplicity, which he finds in Jasmine, which is why he continues to stick with it.

For many developers, Jasmine is still their main go-to JavaScript testing tool because of its simplicity and getting things up and running.

• 11,087 GitHub Stars
• 1,385,198 NPM downloads in the last month

protractor-46461_1280

3. Protractor

Protractor is an automated testing framework for testing AngularJs applications in the browser.

It’s also frequently described as a framework that falls somewhere in the middle of a unit testing and end-to-end test tool that is regularly by both Developers and QA testers.

Nate Taylor, Pluralsight author of the Introduction to Protractor and TDD as a design tool Protractor course and past TestTalks guest describes Protractor with an analogy; think robot users, because it sounds kind of cool, and it also sounds a little more exciting than automated testing. With Protractor, you get to write scripts in JavaScript just like you would in any other Jasmine or Mocha test.

Protractor is a layer that sits on top of Selenium; it runs Selenium in the background, and as a result you get all sorts of really cool hooks into your Angular application. This enables you to start grabbing your data bindings and using some of the Angular goodness like ng-repeats, etc.

You can also grab those elements by the Angular semantics and you can add to them, read from them and verify that your page has the right data. And, it does so whether you're sitting there or not.

According to Nate, it simply runs when you tell it to.

• 5,517 GitHub Stars
• 572,171 NPM downloads in the last month

NightWatchJs

4. Nightwatch.js

Nightwatch.js describes itself as an easy-to-use Node.js-based end-to-end (E2E) testing solution for browser-based apps and websites. It uses the Selenium WebDriver API to perform commands and assertions on DOM elements for front end testing.

Think of Nightwatch.js as a testing framework that is written in JavaScript and designed for web developers. Nightwatch.js gives you an API for writing your test — your test would basically be just node modules — and the runner itself is a Node.js application.


Nightwatch.js test runner can execute tests in parallel. It also works with Selenium Grid and Sauce Labs, and sometimes more importantly, it has good documentation.

• 4,475 GitHub Stars
• 131,501 NPM downloads in the last month

CasperJs

5. CasperJS

CasperJS an open-source navigation scripting and testing utility written in JavaScript for the PhantomJS WebKit headless browser and SlimerJS (Gecko). Rob Friesel mentioned that CasperJS is commonly used on top of PhantomJS to perform things like running screen scraping utilities, automatic screen capture scripts and functional test suites.

As a tool that an awesome job of abstracting away a lot of the complicated, asynchronous stuff you deal with when you’re creating PhantomJS scripts.

The code is also highly readable for creating functional tests, making it easy to use for folks that don’t necessarily have a strong technical background.

• 5,718 GitHub Stars
• 71,815 NPM downloads in the last month

NemoJs

6. Nemo.js

Nemo.js is an open-source, Node.js automation framework that was developed by PayPal. Nemo.js provides a simple way to add Selenium automation to your Node.js web projects. It also provides plugin architecture to incorporate custom features into your tests.

For more in-depth example on how to get started with Nemo.js check out Nilesh Kulkarni's Automation Guild session on Getting Started with Javascript Selenium Automation using Nemo.js.

• 165 GitHub Stars
• 31,387 NPM downloads in the last month

BusterJs

7. Buster.JS

Buster.JS is a browser JavaScript testing toolkit for node and browsers. You can use it to do browser testing for browser-based automation. It can also be used for QUnit-style HTML page testing as well as testing in headless browsers. Buster.JS is currently still in beta mode.

• 446 GitHub Stars
• 6,545 NPM downloads in the last month

DalekJs

8. DalekJS

DalekJs is another open-source UI Test Automation tool that allows you to do cross browser testing with JavaScript. DalekJS is currently a developer preview. According to the documentation, some features are missing, some things might change, and there's a lot of optimization to be done.

For whatever its worth, however, DalekJS has one of the coolest website designs among the frameworks — especially if you’re a Dr. Who fan.

• 686 GitHub Stars
• 589 NPM downloads in the last month

JavaScript Automation Wrap-Up

JavaScript, once thought of as a toy language, is now becoming one of the most-known languages for the web.

If you are involved in testing JavaScript-based web applications you’ll really benefit from learning one of these JavaScript automation frameworks to help boost the productivity of your current teams and enhance you future career options.

This should give you an idea of what is out there already, and hopefully give you enough info to check out more.

These are the top frameworks I’ve come across, but as I mentioned earlier there are tons of JavaScript framework popups everywhere, so I’ll definitely be adding to this list as time goes on.

If one of your favorite automation frameworks is not listed, please let me know and I’ll add it.

17 comments
anwesha - June 16, 2016

Nice informations !

Reply
Gokul - June 17, 2016

Joe – Really useful information. Does any of the above js test frameworks can be utilized to automate jquery applications?

Reply
Compelling Sunday – 28 Posts on Programming and QA - June 19, 2016

[…] The Top 8 Essential JavaScript Automation Frameworks – Joe Colantonio […]

Reply
sergio trajano - August 21, 2016

Great article!

You said that: “Because the testing is headless, the scripts run much faster than a traditional browser-based approach would.”

But I read another article that said the contrary: “Headless browsers aren’t faster than real browsers: contrary to popular belief, headless browsers aren’t faster than real browsers. Most of the time that it takes to load a page is the actual network content: html, JavaScript, images and CSS. This still has to be loaded by a headless browser, it just doesn’t have to render the pixels to a screen. Browser vendors like Google Chrome and Mozilla Firefox invest a lot of time/effort/money to make their browsers and JavaScript engines super fast which we can leverage by running tests in them.”

So, what do you think??

Reply
Biswajit Pattanayak - September 25, 2016

Nice information Joe. I am an automation tester with primary skills in QTP, selenium with python binding. I am a beginner in javascript. I am trying to learn javascript but yet to completely internalise the need to do so for testing. Would you mind guiding me?

Reply
Alessandro - October 10, 2016

I suggest to take a look at CodeceptJS: http://codecept.io/

Reply
Alexander Moskovkin - November 10, 2016

Thanks for the article!

TestCafe was released recently. It’s a pure node.js end-to-end solution for testing web apps. It takes care of all the stages: starting browsers, running tests, gathering test results and generating reports. TestCafe doesn’t need browser plugins – it works in all popular modern browsers out-of-the-box.

https://devexpress.github.io/testcafe/

Reply
Vinutha - November 25, 2016

Squish – Squish uses property-based object identification (independent of screen position), and is able to record and replay test scripts written in JavaScript, Perl, Python, Ruby or Tcl.

Reply
Cristian - January 24, 2017

The article is very interesting, thank you very much for sharing the information.

My only comment is that i think the following statement is slightly inaccurate

“It’s also frequently described as a framework that falls somewhere in the middle of a unit testing and end-to-end test tool that is regularly by both Developers and QA testers.”

Protractor like Selenium is an E2E testing framework. Instead I would say that the “Karma” automation framework is more in the middle of the unit testing and E2E testing

Reply
Vishal Aggarwal - January 25, 2017

Thanks for such informative article Joe,however I would strongly suggest to add Mocha+ chai combination considering its wide user base.

Reply
rup fox - February 25, 2017

Great article. I’m starting to evangelize using raw webdriver js for automated testing. Do you have a link to the ‘analysis’ by dave haeffner showing selenium downloads for javascript?

Reply
Vitalik Zaidman - April 19, 2017

Thanks for the great article!
I included it in the “links” section of my article “A Complete Guide to Testing JavaScript in 2017”:
https://medium.com/powtoon-engineering/a-complete-guide-to-testing-javascript-in-2017-a217b4cd5a2a

Reply
    Joe Colantonio - April 21, 2017

    Awesome – thanks. Why does your article’s formatting look so much better than mine? Does medium handle the formatting for you automatically?

    Reply
Click here to add a comment

Leave a comment: