Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Angular Test-Driven Development
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mastering Angular Test-Driven Development

Mastering Angular Test-Driven Development

By : Ezéchiel Amen AGBLA
4.5 (2)
close
close
Mastering Angular Test-Driven Development

Mastering Angular Test-Driven Development

4.5 (2)
By: Ezéchiel Amen AGBLA

Overview of this book

Do you want to learn how to build robust, reliable, and impressive Angular applications? If yes, then Angular test-driven development is for you! Mastering Angular Test-Driven Development is a comprehensive guide that provides you with essential resources to enhance your skills and deliver high-quality Angular applications. With a practical approach and real-world examples, the book extensively covers TDD concepts, techniques, and tools, going beyond unit testing to explore testing Angular pipes, forms, and reactive programming. In this book, you’ll learn how to validate and manipulate data using pipes, test Angular forms for input validation and user interactions, and handle asynchronous operations with reactive programming. Additionally, you’ll discover end-to-end testing using Protractor, Cypress, and Playwright frameworks, gaining valuable insights into writing robust tests for web applications, navigation, element interaction, and behavior validation. You’ll also understand how to integrate TDD with CI/CD, learning best practices for automating tests, deploying Angular applications, and achieving faster feedback loops. By the end of this book, you’ll be able to successfully implement TDD in your Angular projects with the help of practical examples, best practices, and clear explanations.
Table of Contents (18 chapters)
close
close
Free Chapter
1
Part 1: Getting Started with Test-Driven Development in Angular
4
Part 2: Writing Effective Unit Tests
8
Part 3: End-to-End Testing
12
Part 4: Continuous Integration and Continuous Deployment for Angular Applications

Writing your first E2E test

Once Cypress has been properly configured for E2E testing, we can get down to business. Let’s take a look at how to write our first E2E test:

  1. Now that Cypress is installed and configured, you can start writing your first test. You can click on Create new spec in this interface as shown in Figure 7.11:
Figure 7.11 – Spec creation interface in Cypress

Figure 7.11 – Spec creation interface in Cypress

  1. After doing that, you can see in Figure 7.12 a new file named spec.cy.ts, created in the e2e folder of your project’s cypress folder:

Figure 7.12 – Spec file

Figure 7.12 – Spec file

This file contains the following:

Figure 7.13 – The source code of our spec file

Figure 7.13 – The source code of our spec file

  1. Now, you may be faced with a surprise when you return to the browser where the E2E test is launched as shown in Figure 7.14:
Figure 7.14 – The E2E test failed due to a compilation error

Figure 7.14 – The E2E test failed due to a compilation error...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY