Preface

TestCafe is a self-sufficient, free, and open source end-to-end testing framework that combines unmatched ease of use with advanced automation and robust built-in stability mechanisms. It can be used to write fast and reliable tests.

Modern Web Testing with TestCafe is a comprehensive, project-based introduction for those who are new to TestCafe. You'll build a suite of end-to-end tests while learning the core methods and concepts along the way.

You'll 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 to writing production-ready tests. Throughout the book, we'll build a sample set of tests step by step that will log in to the 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. While this test suite is relatively simple to build, it allows some of the most prominent features of TestCafe to be showcased. Additionally, it demonstrates the running of the tests against a free and simple-to-use website, and it does not require readers to build and deploy their own servers or backend services.

By the end of this book, you will know how to write and enhance end-to-end tests with TestCafe in order to solve real-world problems and deliver results. You'll also have a proof of concept to demonstrate to others.

Who this book is for

This book is intended for quality assurance engineers, test automation engineers, software engineers in test, SDETs, and software project managers interested in using TestCafe for test automation. Full stack software developers and professionals responsible for creating enterprise-based testing frameworks will also find this useful. A basic knowledge of JavaScript/Node.js, CSS selectors, HTML and Bash is necessary.

What this book covers

Chapter 1, Why TestCafe?, explains what TestCafe is and what its main features are.

Chapter 2, Exploring TestCafe under the Hood, takes a deeper dive into how TestCafe works and what secrets are hidden under its hood.

Chapter 3, Setting Up the Environment, covers how to set up the environment in order to run the tests.

Chapter 4, Building a Test Suite with TestCafe, explains, having covered the main concepts of TestCafe and reviewed its arsenal, how to draw a weapon and write some tests.

Chapter 5, Improving the Tests, covers how to extend the tests and add setup and teardown.

Chapter 6, Refactoring with PageObjects, covers how to make the tests more effective and transparent by refactoring with PageObjects.

Chapter 7, Findings from TestCafe, provides a quick overview of what lies ahead.

To get the most out of this book

The following table shows the minimum software requirements for this book:

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the Support tab.
  3. Click on Code Downloads.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows.
  • Zipeg/iZip/UnRarX for Mac.
  • 7-Zip/PeaZip for Linux.

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Modern-Web-Testing-with-TestCafe. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: 'Open basic-tests.js in a code editor (or IDE) of your choice and let's create a simple test.'

A block of code is set as follows:

const { Selector } = require('testcafe');fixture('My first set of tests');test('My first test', async (t) => {    // Your test code });

Any command-line input or output is written as follows:

$ cd test-project/

$ mkdir tests

Bold: Indicates a new term, an important word, or words that you see on screen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: 'Expected result: 'Issue created' notification should be displayed:'

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.4