Testing
spring-test
模块提供了 @{2} 、@{3} 和 @{4} 的模拟实现。请参阅 @{5} 了解模拟对象的探讨。
The spring-test
module provides mock implementations of ServerHttpRequest
,
ServerHttpResponse
, and ServerWebExchange
.
See Spring Web Reactive for a
discussion of mock objects.
WebTestClient
基于这些模拟请求和响应对象来提供在没有 HTTP 服务器的情况下测试 WebFlux 应用程序的支持。您还可以将 WebTestClient
用于端到端集成测试。
WebTestClient
builds on these mock request and
response objects to provide support for testing WebFlux applications without an HTTP
server. You can use the WebTestClient
for end-to-end integration tests, too.