WebTestClient
WebTestClient is a Spring testing client for exercising HTTP endpoints and verifying their responses, including in reactive applications.
Testing Spring Boot Applications
WebTestClient is Spring's HTTP testing client for exercising web applications, including reactive applications, without requiring a browser.
- How it is used
- Exercises WebFlux endpoints when the mock MVC stack and MockMvcTester are unavailable.
- How deep it goes
- Shows dependency, autoconfiguration, request and assertion code, then contrasts mock execution with full-server tests.
- Examples
- Tests a GET response for a selected city and converts another response for fluent AssertJ assertions.
- What you can do after
- Apply it via WebTestClient to check response status and body in mock or random-port web tests.
Read how Testing Spring Boot Applications explains WebTestClient →
Spring in Action, Sixth Edition
WebTestClient is a Spring reactive testing client for exercising HTTP endpoints and verifying their responses without starting a server.
- How it is used
- Tests reactive WebFlux controllers through HTTP-like requests and response assertions.
- How deep it goes
- Covers focused controller tests and live-server integration tests, but does not explain WebTestClient internals.
- Examples
- Uses TacoController GET and POST tests, mocked TacoRepository data, JSON fixtures, JSONPath expressions, and RANDOM_PORT integration tests.
- What you can do after
- Apply it via WebTestClient to verify reactive endpoint status codes, JSON payloads, typed bodies, and HTTP method behavior.
Read how Spring in Action, Sixth Edition explains WebTestClient →
Also covered in
- Spring Security in Action, Second Edition
- Spring Start Here, Second EditionIn early access (MEAP)
What to know first
- reactive applicationA reactive application is a software application that responds to events or other stimuli while coordinating asynchronous, nonblocking processing of data and tasks.
Related concepts
- @AutoConfigureWebTestClientconfigured by · @AutoConfigureWebTestClient is a Spring Boot test annotation that configures a WebTestClient bean for testing a reactive web application.
- json()uses · json() is a WebTestClient assertion operation that compares a response body with an expected JSON string.
- software testingused by · Software testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
- WebClientequivalent to · WebClient is Spring’s nonblocking, reactive HTTP client API for making requests to external services and processing their responses.
- ExchangeFunctionuses · ExchangeFunction is a Spring WebFlux abstraction that asynchronously maps an HTTP request to an HTTP response.
- JSONPathuses · JSONPath is a query language for selecting and extracting values from JSON data.
Questions about WebTestClient
What is WebTestClient?
WebTestClient is a Spring testing client for exercising HTTP endpoints and verifying their responses, including in reactive applications.
Which Manning books explain WebTestClient?
Testing Spring Boot Applications and Spring in Action, Sixth Edition.
What should I know before learning WebTestClient?
Manning books that teach WebTestClient usually introduce reactive application first.
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.

