wip-1.5

2026-06-05 ⏳1.0分钟(0.4千字)

1.5 What you will learn in this book

1.5 你将从本书学到什么

This book teaches a frame of reference that you can use to analyze any test in your test suite. This frame of reference is foundational. After learning it, you’ll be able to look at many of your tests in a new light and see which of them contribute to the project and which must be refactored or gotten rid of altogether.

本书会教授一套参照框架,你可以用它分析测试套件中的任何测试。这套参照框架是基础性的。学会之后,你将能够用新的视角审视自己的许多测试,看出哪些测试对项目有贡献,哪些测试必须重构,或者干脆删除。

After setting this stage (chapter 4), the book analyzes the existing unit testing techniques and practices (chapters 4–6, and part of 7). It doesn’t matter whether you’re familiar with those techniques and practices. If you are familiar with them, you’ll see them from a new angle. Most likely, you already get them at the intuitive level. This book can help you articulate why the techniques and best practices you’ve been using all along are so helpful.

在奠定这个基础之后(第 4 章),本书会分析现有单元测试技术和实践(第 4–6 章,以及第 7 章的一部分)。你是否熟悉这些技术和实践并不重要。如果你熟悉它们,你会从新的角度看待它们。很可能你已经在直觉层面理解它们。本书可以帮助你清楚表达:为什么你一直使用的技术和最佳实践如此有帮助。

Don’t underestimate this skill. The ability to clearly communicate your ideas to colleagues is priceless. A software developer—even a great one—rarely gets full credit for a design decision if they can’t explain why, exactly, that decision was made. This book can help you transform your knowledge from the realm of the unconscious to something you are able to talk about with anyone.

不要低估这项能力。能够向同事清楚表达自己的想法是无价的。一个软件开发者,即使非常优秀,如果无法准确解释为什么做出某个设计决策,也很少能让这个决策得到充分认可。本书能帮助你把停留在潜意识层面的知识,转化为可以和任何人讨论的东西。

If you don’t have much experience with unit testing techniques and best practices, you’ll learn a lot. In addition to the frame of reference that you can use to analyze any test in a test suite, the book teaches:

如果你对单元测试技术和最佳实践经验不多,你会学到很多。除了这套可以用来分析测试套件中任何测试的参照框架之外,本书还会教授:

In addition to unit tests, this book covers the entire topic of automated testing, so you’ll also learn about integration and end-to-end tests.

除了单元测试之外,本书还覆盖自动化测试的整个主题,因此你也会学到集成测试和端到端测试。

I use C# and .NET in my code samples, but you don’t have to be a C# professional to read this book; C# is just the language that I happen to work with the most. All the concepts I talk about are non-language-specific and can be applied to any other object-oriented language, such as Java or C++.

我在代码示例中使用 C# 和 .NET,但你不必是 C# 专家才能阅读本书;C# 只是我最常使用的语言而已。我讨论的所有概念都不依赖特定语言,可以应用到任何其他面向对象语言中,例如 Java 或 C++。