whatsapp

Selenium vs Puppeteer vs Chai Mocha

Selenium

Monday August 26, 2019

The software life cycle has undergone drastic changes in the last decade. So much to an extent where the role of the tester has completely changed! With the coming in of the PDO (Product Driven Organization) structure, there are no more testers and developers but only full-stack engineers. Bottom line is testing still needs to be done.

Who does that? How does it fit in the 2-week agile sprint? Is manual testing even possible in such a short time?

The Answer

To start with, the scope for manual testing has reduced. Agree to it or not. This is what happens in real-life scenarios. Since testing is still a task on our User Stories, it needs to be completed. Most teams take the help of automation tools.

Now here is the challenge, many small and even big companies are going to the open-source automation tools which give them the flexibility to customize as per their need without any investment. There are several tools available for you to choose based on the kind of application you have like a web-based app or a mobile app or a desktop software etc.

Selenium

Selenium has established itself as the most popular web browser automation tool with support for most of the available browsers including Chrome, Mozilla, Opera, and Safari, etc. with equal ease and flexibility. It also supports scripting in several languages including Java, Python, and C#. This enables even developers to write create and execute automation test cases through Selenium.

This is also an open-source tool that makes it more acceptable to companies. This tool has become so popular because of the flexibility and controls it offers in execution the commands on the browser. Multiple browser support means that we can use it for cross-browser testing as well. There are several other advantages as well when it comes to Selenium.

Puppeteer

When it comes to web automation the most commonly used browser is Chrome which is from Google. Now Puppeteer is a node.js library from Google as well, which gives you a high-level API control over Chrome and Chromium using the DevTools protocol. In simpler terms, being from the same parent gives it greater control and flexibility to work with Chrome. With Puppeteer you can take a deep dive into Chrome functionalities easily which could be a challenge when it comes to other open-source automation tools.

Chai Mocha

Chai and Mocha are JavaScript frameworks that are commonly used together. Mocha is a simple testing framework that will allow you to execute a set of functions in sequence. The results of these tests are displayed on the terminal window. While Chai is an assertion library that is used to validate the test case results. By using Chai with Mocha the user can get the results in the required format. This Chai Mocha framework is frequently used for unit testing by developers to perform tests and report results.

Hope you have got a basic understanding of these tools. Now let us see some comparative data for these 3 tools, to help you understand which one to choose for your need.

 

 

 

Language Support

Se supports scripting in Java, Python, Node.js & C# meaning, you can choose from supported languages and find the supporting jar files to get started. Puppeteer supports only JavaScript for Node.js. This is a major limitation when it comes to the usage of this tool Chai Mocha again uses JavaScript for its unit test framework
 

Browser Support

Gives you the flexibility to work with most browsers including Chrome, Mozilla, Safari, IE, Opera, etc. Supported by Google and hence has a maximum support for Chrome It supports testing in Chrome and Firefox. it can be leveraged for other browsers with some challenges.
 

 

Community Support

There are several helpful groups, communities and WhatsApp groups where you can post your questions and concerns to get solutions in quick time. Apart from some Google groups, you would hardly find any relevant support as this tool is used by a very small testing community The support community is limited. But you can still find some help online in forums like Quora, StackOverflow, etc. and others.
 

 

Execution Speed

Compared to Puppeteer, Selenium is slower only in Chrome. But it still works at a good speed with respect to any automation tool. Puppeteer works pretty fast compared to any other automation tool in Chrome while it provides no support to other tools        —
 

 

Ease of Installation

For someone who is new to tool installations, it can look a bit complex. But there are a lot of help documents and videos available to help you if you get stuck anywhere The installation is pretty simple and can be easily done by most people. It is a single command installation from NPM There are several steps included in the installation of chai mocha starting from Node.js and NPM. One-click setup is not available for this framework.
 

Multi-Platform Support

Se provides Multi-browser and multi-platform support to make things easier for you. Does not support multi-platform testing Supports to some extent.
 

 

Recording

To make it easier for people with no coding background, Se offers recording option to make using the automation tool easy. No recording options are available No recording options are available
 

Screenshots

it allows you to take and save screenshots in image format only it allows you to save screenshots in image and pdf format A separate package “mochawesome” needs to be installed to get the screenshots

 

Let us see how the tools discussed here can help you with your testing tasks.

Testing Type Selenium Puppeteer Chai Mocha
Functional Yes Yes Yes
Regression Yes Yes Yes
Sanity Yes Yes Yes
Smoke Yes Yes Yes
Responsive Yes No No
Cross Browser Yes No Yes
GUI (Black Box) Yes Yes Yes
Integration Yes No No
Security Yes No No
Parallel Yes No Yes

 

Hope this data comparison is helpful for you to decide which one to pick up for your team and project. My suggestion, if you are dealing with only Chrome then goes for Puppeteer.

But if you want your application to run across all platforms and you want it to be tested in multiple browsers and platforms Selenium would be the right choice.

With Selenium, the coding and tool expertise required is also limited, which means you can build up your team and competency faster. So our personal choice is Selenium which offers more features and online support forums for guidance as well.

Take your pick.

Mail

Hire

Cost Calc.

WhatsApp

Call Us