Adding Automated Tests

Now, it's time to get our Q and A app ready for production. In this chapter, we are going to add automated tests to the frontend and backend of our app, which will give us the confidence to take the next step: moving our app into production.

First, we will focus on the backend and use xUnit to implement unit tests on pure functions with no dependencies. Then, we'll move on to test controllers and mock out their dependencies using Moq.

Next, we will turn our attention to testing frontends with the popular Jest tool. We will learn how to implement unit tests on pure functions and integration tests on React components by leveraging the fantastic React Testing Library.

Then, we will learn how to implement end-to-end tests with Cypress. We'll use this to test a key path through the app where the frontend and backend will be working together.

In this chapter, we'll cover the following topics:

  • Understanding the different types of automated test
  • Implementing .NET tests with xUnit
  • Implementing React tests with Jest
  • Testing React components
  • Implementing end-to-end tests with Cypress

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

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