Modern Web Testing with TestCafe
eBook - ePub

Modern Web Testing with TestCafe

Get to grips with end-to-end web testing with TestCafe and JavaScript

Dmytro Shpakovskyi

Condividi libro
  1. 168 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Modern Web Testing with TestCafe

Get to grips with end-to-end web testing with TestCafe and JavaScript

Dmytro Shpakovskyi

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

A no-nonsense guide to getting started with TestCafe quickly by building a complete test suite while learning the core concepts of test automation with TestCafe

Key Features

  • Build a proof-of-concept project to demonstrate your familiarity with TestCafe
  • Discover useful tips and best practices for building production-ready and fault-tolerant tests
  • Write clean and maintainable tests by refactoring your codebase using PageObject pattern

Book Description

TestCafe is an open source end-to-end testing framework that combines unmatched ease of use with advanced automation and robust built-in stability mechanisms. This book is a comprehensive, project-based introduction to TestCafe that will show you how to use the TestCafe framework and enable you to write fast and reliable tests; plus you'll have a proof of concept ready to demonstrate the practical potential of TestCafe.

You'll begin by learning how to write end-to-end web tests using the TestCafe syntax and features of the TestCafe framework. You'll then go from setting up the environment all the way through to writing production-ready tests. You'll also find out how to build a sample set of tests in a step-by-step manner and use TestCafe to log in to the website, verify the elements present on different pages, create/delete entities, and run custom JavaScript code. As you advance, you'll delve into several stages of refactoring that will take you through the showcase setup/teardown and PageObject patterns. While this test suite is relatively simple to build, it showcases some of the most prominent features of TestCafe. Finally, this TestCafe book will show you how the tests can be run on a free and simple-to-use website, without requiring you to build and deploy your own servers or backend services.

By the end of this book, you'll have learned how to write and enhance end-to-end tests with TestCafe to solve real-world problems and deliver results.

What you will learn

  • Understand the basic concepts of TestCafe and how it differs from classic Selenium
  • Find out how to set up a TestCafe test environment
  • Run TestCafe with command-line settings
  • Verify and execute TestCafe code in the browser
  • Automate end-to-end testing with TestCafe using expert techniques
  • Discover best practices in TestCafe development and learn about the future roadmap of TestCafe

Who this book is for

The book is for QA professionals, test engineers, software engineers, and test automation enthusiasts looking for hands-on guidance on learning about TestCafe. This book is also great for full-stack developers who want to learn more about new tools for testing their code. The book assumes a basic understanding of JavaScript, Node.js, HTML, CSS, and some simple Bash commands.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Modern Web Testing with TestCafe è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Modern Web Testing with TestCafe di Dmytro Shpakovskyi in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Quality Assurance & Testing. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2020
ISBN
9781800205963

Chapter 1: Why TestCafe?

TestCafe—a new promising software testing framework or just a place where you can eat? Here, we will take a look at what TestCafe is and what its main features are. What is the technology? What do you need to know? How does it integrate with other tools? In this book, we will see what TestCafe is used for, go through its main features, and compare it with a well-known industry standard—Selenium.
More practically, we will develop a set of tests for a bug tracking system. You will learn how to write end-to-end tests using the TestCafe syntax and the features of the TestCafe framework. You'll go from setting up the environment all the way down to writing production-ready tests.
Throughout this book, we'll build a sample set of tests step by step that will log in to a website, verify the elements present on different pages, create/delete entities, and execute custom JavaScript code using TestCafe. Additionally, there will be several stages of refactoring to showcase setup/teardown and PageObjects.
Note
Please keep in mind that this book does not pretend to be the only source of truth - its main goal is to demonstrate some original approaches, not to enforce the strict rules. Feel free to use and extend all the techniques explored in this book.
By the end of this chapter, we will have a clear idea of TestCafe and what lies ahead—a plan of features that will be tested. We will also review the demo website and come up with a set of test cases that will be automated in the upcoming chapters.
To sum up the contents of this chapter, the following main topics will be covered:
  • Introducing TestCafe.
  • Exploring the main features of TestCafe.
  • Comparing TestCafe and Selenium.
  • Reviewing the test project we will build.

Introducing TestCafe

If you work for a huge enterprise company or a small but innovative start-up and your automated tests need to support customers with older browsers the same as the new ones, you should definitely try TestCafe. Just like Selenium, it's open source, but you don't have to install any other packages or additional web drivers. TestCafe is a self-sufficient, free, end-to-end testing framework that combines unmatched ease of use with advanced automation and robust built-in stability mechanisms.
It was created by DevExpress (https://github.com/DevExpress) and was open sourced under the MIT license. TestCafe can take care of all stages of the automated testing process:
  • Launching applications before tests.
  • Launching different browsers.
  • Running tests.
  • Taking screenshots.
  • Outputting test results.
TestCafe does not require any additional installation of browser plugins and works in all major modern browsers right out of the box. It is gaining popularity as a faster and easier-to-use solution compared to Selenium.
Now that we've had a quick glimpse of what TestCafe is, let's continue with an overview of its main features.

Exploring the main features of TestCafe

Now, let's take a more detailed look at all the bells and whistles that TestCafe has to offer:
  • Pretty much all TestCafe needs to run is a browser and Node.js configured on your machine, so there is minimal setup.
  • TestCafe can run tests in headless mode (on Chrome or Firefox) without a need to render a Document Object Model (DOM). This feature is extremely useful when running tests on any Continuous Integration (CI) system.
  • TestCafe supports all main operating systems, including Windows, macOS, and Linux.
  • The officially supported browsers of TestCafe are Google Chrome (Stable, Beta, Dev, and Canary), Internet Explorer (11+), Microsoft Edge (Legacy and Chromium-based), Mozilla Firefox, Safari, Google Chrome mobile, and Safari mobile – so it is cross-browser. You can find a full list of supported browsers and their aliases at https://devexpress.github.io/testcafe/documentation/guides/concepts/browsers.html#officially-supported-browsers.
  • Tests can be written in the latest JavaScript (ES6+), TypeScript, or CoffeeScript formats (we will be using JavaScript to demonstrate this in the upcoming chapters).
  • Clear and flexible API with support of the PageModel pattern (we will see how this works in Chapter 6, Refactoring with PageObjects).
  • Stable tests due to the smart assertion and automatic waiting mechanisms (this will be discussed in Chapter 2, Exploring TestCafe Under the Hood).
  • TestCafe has a lot of free custom plugins: cloud browser providers and emulators (SauceLabs, BrowserStack, CrossBrowserTesting, and so on), framework-specific ...

Indice dei contenuti