WebApplicationFactory
WebApplicationFactory is an ASP.NET Core testing API that bootstraps an application in an in-memory host and provides clients for functional and integration testing.
ASP.NET Core in Action, 3e
WebApplicationFactory is an ASP.NET Core testing API that bootstraps an application for in-memory functional and integration testing and permits test-specific customization.
- How it is used
- Tests a real ASP.NET Core application through in-memory HTTP requests and its configured framework pipeline.
- How deep it goes
- Explains setup, request verification, service replacement, and custom factories, but defers database-specific testing to a separate treatment.
- Examples
- Demonstrates GET /ping returning pong and a currency endpoint using a stub converter that returns 3.
- What you can do after
- Apply it via Microsoft.AspNetCore.Mvc.Testing to verify endpoints and substitute test services without starting an external server.
Read how ASP.NET Core in Action, 3e explains WebApplicationFactory →
.NET in Action, Second Edition
WebApplicationFactory is an ASP.NET Core testing API that creates an in-memory application host and a client for sending requests to it.
- How it is used
- Exercises an ASP.NET Core API across configuration, dependency injection, HTTP routing, and application logic without leaving the test process.
- How deep it goes
- Explains host creation, client-start timing, service replacement, environment selection, and response assertions, but not framework internals.
- Examples
- Uses a ComicFinderService, a fake external HTTP handler, and a search request whose JSON response is checked for one comic.
- What you can do after
- Diagnose integration behavior by sending real HTTP-style requests through a configured in-memory application and asserting complete responses.
Read how .NET in Action, Second Edition explains WebApplicationFactory →
Related concepts
- api calluses · An API call is a programmatic request or invocation sent through an application programming interface to retrieve data or invoke an exposed operation.
- HTTP clientproduces · An HTTP client is software that constructs and sends HTTP requests and receives and processes the corresponding responses.
- IClassFixture<TFixture>used by · IClassFixture<TFixture> is an xUnit interface that provides one shared fixture instance to the tests in a class.
- TestServeruses · TestServer is an ASP.NET Core in-memory server that accepts test requests and returns responses without requiring a network server.
- integration testused by · An integration test evaluates whether multiple software components or a component and an external dependency interact and behave correctly together.
Questions about WebApplicationFactory
What is WebApplicationFactory?
WebApplicationFactory is an ASP.NET Core testing API that bootstraps an application in an in-memory host and provides clients for functional and integration testing.
Which Manning books explain WebApplicationFactory?
ASP.NET Core in Action, 3e and .NET in Action, Second Edition.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

