Spring WebFlux, unit testing Mono and Flux

It seems that the best practice is to use the WebTestClient. However this one can be used without a running server;

The spring-test module includes a WebTestClient that can be used to test WebFlux server endpoints with or without a running server.

-- https://docs.spring.io/spring/docs/5.0.0.BUILD-SNAPSHOT/spring-framework-reference/html/web-reactive.html#web-reactive-tests


It depends on what exactly you want to test, for regular method you should use StepVerifier in favor of consume the output of you test. However router functions are unique, because, usually return a serverResponse that contains your data on body, so in that case its better use webClient or webTestClient.