liveBook · Manning

WebTestClient

WebTestClient is a Spring testing client for exercising HTTP endpoints and verifying their responses, including in reactive applications.

How 2 Manning books explain it

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

What to know first

Related concepts

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.