0%

Book Description

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.

Table of Contents

  1. Modern Web Testing with TestCafe
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Conventions used
    6. Get in touch
    7. Reviews
  8. Chapter 1:
  9. Why TestCafe?
    1. Introducing TestCafe
    2. Exploring the main features of TestCafe
      1. Introducing TestCafe Studio
    3. Comparing TestCafe and Selenium
    4. Reviewing the test project we will build
      1. Selecting a test application
      2. Writing test cases
    5. Summary
  10. Chapter 2:
  11. Exploring TestCafe Under the Hood
    1. Scouting the TestCafe architecture
      1. The server side
      2. The client side
    2. Learning about the TestCafe API
      1. Elements selection
      2. Assertions
      3. User roles
    3. Executing custom client-side code
    4. Summary
  12. Chapter 3:
  13. Setting Up the Environment
    1. Technical requirements
    2. Setting up the test project environment
      1. Installing Node.js
      2. Installing TestCafe
    3. Creating the test project configuration file
      1. Accepting code styling convention
      2. Exploring the configuration settings
    4. Creating a basic configuration for the test project
    5. Structuring the test code
      1. Fixtures
      2. Tests
      3. The starting web page
      4. Metadata
      5. Skipping tests
    6. Summary
  14. Chapter 4:
  15. Building a Test Suite with TestCafe
    1. Technical requirements
    2. Creating a test
      1. Running the test
      2. Performing actions
    3. Debugging the tests
      1. Debugging tests in TestCafe
      2. Debugging tests in Chrome Developer Tools
    4. Writing the test project log in tests
    5. Adding verifications to the test project
      1. Adding assertion for the user creation test
      2. Adding assertion for the log in test
      3. Adding the log out test
    6. Adding custom code execution to the test project
    7. Adding more tests
      1. Adding the new issue creation test
      2. Adding the new issue is displayed on a project page test
      3. Adding the issue editing test
      4. Adding the updated issue is displayed on a project page test
      5. Adding the issue searching test
      6. Adding the issue deletion test
      7. Adding the file uploading test
      8. Adding the file deletion test
    8. Summary
  16. Chapter 5:
  17. Improving the Tests
    1. Technical requirements
    2. Executing selected tests
    3. Exploring test setup and teardown
    4. Running tests with command-line settings
    5. Summary
  18. Chapter 6:
  19. Refactoring with PageObjects
    1. Technical requirements
    2. Adding a Role for logging in
  20. Chapter 7:
  21. Findings from TestCafe
    1. Technical requirements
    2. Taking a final step with test functions
    3. Exploring TestCafe development and future plans
    4. Additional references to useful resources
    5. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.116.63.236