WebApplicationFactory
An ASP.NET Core testing class that starts your real application in memory and gives tests an HttpClient connected to it.
In more detail
Requests go through routing, middleware, binding, authorization and serialisation just as in production, without opening a network port. Replace only infrastructure the test must control, such as the database.
Related terms
- integration test — A test that checks several real parts working together, such as the service talking to a real database.
- in-memory host — The application running inside the test process with an in-memory server, so tests send real HTTP requests without a network.
- test fixture — Fixed, known data or setup that tests use so their results are predictable, such as a sample file, a seeded database or a started application.
Taught in
- Integration Testing with WebApplicationFactory — Modern .NET Core, C# & Enterprise Microservices