Testing in ASP.NET Core (Part 2 – Integration Testing)
In Chapter 9, we learned how to write unit tests for a ASP.NET Core web API application. Unit tests are used to test code units in isolation. However, a code unit often depends on other components, such as the database, external services, and so on. To test the code thoroughly, we need to test the code units in the context of the application. In other words, we need to test how the code units interact with other parts of the application. This type of testing is called integration testing.
In this chapter, we will mainly focus on integration testing. We will cover the following topics:
- Writing integration tests
- Testing with authentication and authorization
- Understanding code coverage
By the end of this chapter, you should be able to write integration tests for a ASP.NET Core web API application.