# 11.3 测试响应式 Controller

在测试响应式 Controller 时，Spring 5 并没有让我们陷入困境。实际上，Spring 5 引入了 WebTestClient，这是一个新的测试程序，它让用 Spring WebFlux 编写的响应式 Controller 变得容易测试。让我们首先使用它测试在第 11.1.2 节中编写的 DesignTacoController 中的 recentTacos() 方法，来了解如何使用 WebTestClient 编写测试用例。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://potoyang.gitbook.io/spring-in-action-v5/di-11-zhang-kai-fa-xiang-ying-shi-api/11.3-ce-shi-xiang-ying-shi-jie-kou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
