Book Image

A Frontend Web Developer’s Guide to Testing

By : Eran Kinsbruner
3 (1)
Book Image

A Frontend Web Developer’s Guide to Testing

3 (1)
By: Eran Kinsbruner

Overview of this book

Testing web applications during a sprint poses a challenge for frontend web app developers, which can be overcome by harnessing the power of new, open source cross-browser test automation frameworks. This book will introduce you to a range of leading, powerful frameworks, such as Selenium, Cypress, Puppeteer, and Playwright, and serve as a guide to leveraging their test coverage capability. You’ll learn essential concepts of web testing and get an overview of the different web automation frameworks in order to integrate them into your frontend development workflow. Throughout the book, you'll explore the unique features of top open source test automation frameworks, as well as their trade-offs, and learn how to set up each of them to create tests that don't break with changes in the app. By the end of this book, you'll not only be able to choose the framework that best suits your project needs but also create your initial JavaScript-based test automation suite. This will enable fast feedback upon code changes and increase test automation reliability. As the open source market for these frameworks evolves, this guide will help you to continuously validate your project needs and adapt to the changes.
Table of Contents (19 chapters)
1
Part 1 – Frontend Web Testing Overview
7
Part 2 – Continuous Testing Strategy for Web Application Developers
11
Part 3 – Frontend JavaScript Web Test Automation Framework Guides

Getting started with the Cypress framework

As noted earlier in the chapter, Cypress (https://www.cypress.io/) is by far the fastest and most adopted cross-browser frontend JavaScript testing framework. It is a developer-friendly, fast execution solution by design, and runs on the browser. In this section, we will learn how to install, set up, and run the first Cypress test in JavaScript. Note that Cypress also supports TypeScript and can be configured to run with the Cucumber BDD framework as well.

To get started with Cypress, please run the following command to install the node package on your machine:

npm install cypress --save-dev

Similar to Selenium and JavaScript, Cypress also requires Node.js to be installed on the local machine to run the Cypress tests. If you do not have Node.js installed, please make sure that, in addition to the installation of Cypress, you install it as a dependency as well.

Once the Cypress framework is installed, users can drive the tests either...