What Is Mocha?
Mocha is extremely popular and very well maintained. It has over 21k stars on Github at the time of writing and has been around for over a decade. Its documentation is well written and easy to follow.
Testing With Mocha
If you are looking for an easy to learn and quick to understand automated testing tool then Mocha is the tool.
Benefits of Mocha
- Flexible open-source automation tool
- Mocha does not come with mocking framework and assertion library. To put this in easier terms, you can select any library or framework while testing using Mocha
- A lot of tools have been built around Mocha, and hence it is an adaptive testing framework.
- One other important reason why Mocha is used extensively is that it has a highly active community setup
- Great support is available through blog posts, videos, podcasts, and libraries
- This testing Framework has a number of installation options
- Mocha supports both Test-Driven Development, known as TDD and BDD abbreviated as Behavior Driven Development
- Not only is Mocha compatible with most web browsers, but it also allows developers to run tests for different browser-specific methods and options
What is Protractor?
Most importantly Protractor has been abandoned by its maintainers and is end of life Summer 2023. Given its 8.8k stars on Github and its heavy usage by certain parts of the Angular community, it is still worth understanding. Protractor is an opensource end to end testing automation tool built by Google, for Angular and AngularJS applications. Although it might be expected that the tool can only be used for Angular applications, it can also be used for non-Angular applications. The testing is automated on an actual browser.
What Is Puppeteer?
Puppeteer was originally created by the Chrome/Google development team, Puppeteer automates Chromium based browser (Chrome, Edge, Brave and even Firefox). It runs in both headless and interactive mode. Headless being the default, it runs the browser emulation without needing to render it to screen.
With a massive 79.8k stars at the time of writing, this is one of the most popular libraries on Github, and is used by many organisations for many purposes ranging from test, to gathering information for several purposes. Adappt used this in 2020 to gather Covid stats from each govt for the World Health Organization.
The real power of Puppeteer is that it will faithfully render pages in the same way as Chrome / Edge, using the very latest release of the Chromium engine and all whilst running in headless mode. This makes it perfect for integration into CI/CD pipelines running on servers without GPUs
Puppeteer can be used for automated browser testing. It is fast and robust and has a ‘clean syntax’ that allows the user to write readable tests.
What Is Selenium?
Selenium is now one of the most popular free (open source) automation tools and automates the browser to perform the many actions that would have previously been done manually. As mentioned, it records; has playback, and highlights errors while testing web apps. It can run multiple scripts across several browsers.
It supports various operating systems and works across various browsers (e.g. Firefox, Chrome, IE, Edge, Safari, Opera) and devices.
It is easy to install and provides constant updates. It has multiple simple and easy navigation tools to assist writing test cases without requiring scripts.