[Design Principles and Models of] how to understand the three rules of TDD

cp from  :  https://blog.csdn.net/ibelieve1974/article/details/54948031 

 

How to understand TDD three rules of Uncle Bob?
The first and third are only talking about and just. Code can be written only in the case of Case False. As long as newly written by the Code makes Case, do not write any new function code. Reconstruction is possible.
The second is to say only allowed to write code Case of failure. This one has a doubt the operation. For example, to write an algorithm, first write a Case authentication, and then write the code. Case after the adoption, to verify the exceptional value, and wrote a Case, Case also fortunate result of the Pass. Is this not a violation of the rules of TDD Uncle Bob 2 it? After consultation with James Grenning, doing so is possible. The second allows you to write only failed Case refers to new functionality for unrealized. For example, the original plan to write 5 Case test function, when you complete the development and testing function 12 and, you're right unrealized write functional test case 3, of course, fail in. But this does not prevent you continue to write to increase the functional verification case 1 and 2 tests.

Are not allowed to the Write by You Production's code The unless the any IT IS A to the make failing unit test Pass.
1, except to make a failing unit test pass, otherwise not allowed to write any production code
You are not allowed to write any more of a unit Within last IS Sufficient to Fail Test; and are failures The failures The Compilation.
2. In a unit test only allows you to write just enough to cause the contents of failure (compilation error can be considered failed)
by You are not allowed to the Write the any More Production's code Within last IS Sufficient to Pass at The One failing Unit the Test.
3, only allows you to write just to make a failed unit test by product code

 


---------------------
Author: Sleeping-Cat
Source: CSDN
Original: https: //blog.csdn.net/ibelieve1974/article/details/54948031
copyright notice : This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/0616--ataozhijia/p/11079644.html