As I said last month, writing just enough code to make a test pass keeps code simpler and keeps me focused on the task at hand.
正如我上月所述,编写足够的代码以使测试通过可以简化程序代码,从而有更多的精力关注手边的工作。
TDD requires that you do the opposite: write the test first and allow it to inform how you write the code that makes the test pass.
TDD要求您反过来做:先编写测试,并让它来提示如何编写可以让测试通过的代码。
You are not allowed to write any production code unless it is to make a failing unit test pass.
在写完“红色”(无法通过测试)的单元测试代码之前,不允许写任何的产品代码。
You are not allowed to write any production code unless it is to make a failing unit test pass.
在写完“红色”(无法通过测试)的单元测试代码之前,不允许写任何的产品代码。
应用推荐