# 测试

本章介绍Spring对集成测试的支持和单元测试的最佳实践。 Spring团队提倡测试驱动开发（TDD）。 Spring团队发现正确使用控制反转（IoC）肯定会使单元测试和集成测试更容易（因为类的setter方法和适当的构造函数的存在使得它们更容易在测试中连接在一起而不必设置服务定位器注册表和类似结构）。


---

# 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://docs.flydean.com/spring-framework-documentation5/testing.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.
