Explain TDD in Simple Words

I was looking through StackOverflow when I came across this question. Here the author mentions his debugging style:

I am wondering how to do debugging. Currently, the following steps:

  • I am completing a large script,
  • Comment on everything except the part I want to check.
  • Execute script

and in one of the answers, another user says that the crawler is debugging the wrong path:

Your sequence seems completely opposite to me. Here is how I do it:

  • I am writing a test for the functionality I need.
  • I start writing a script by executing a bit and checking the test results.
  • I look through what I did to document and publish.

, -. , Test-driven development, .

TDD ?

+3
9

.

... ... , -.

. , , .

. . .

TDD ?

.

TDD , .

. . , .

" , , ", , . , - - , .

, .

0

, . . - , ATDD BDD , , .

- ( , - ) . , :

  • [] script,
  • , , , , .

, script , , - . , . , , . ; , , . , , , .

, , . , , , ? ? , TDD. , . , , , , , , , .

, , , , . TDD - .

+4

.

, , . , , . "" (, ), "" (, .)

TDD, , .

+3

TDD . , .

, :

  • - , ( )
  • - , , .
  • - 1, .

, , . , , . , ( = ).

TDD , 100% ( ) . , , , . :

  • , ( ), ( )
  • , .
  • , , , - ( , , , )

, , , . , , // . , , , , - (, ) .

+2

, :

  • script,
  • , , .
  • script

. ", " , . , , , , ( !), - ( , , ). . , , , - , , , , .

TDD - - . , , , . ; () ; . , - , , - . , , , - . , , ; , .

: , , ; , ; unit test. .

+2

, , TDD ACTUAL . , . , , . . .

, -? , . . , , , 100- , , . , , , , ..

TDD, , , .

+1

TDD. TDD , , , TDD:

  • .
  • , , . - , YAGNI.
  • : , , ( , , TDD , ). .
  • , .

TDD , , , , . , .

, , TDD hardliner. , - . , TDD, , , (, ViewResult ASP.NET MVC).

+1

TDD , , , , = > .

100% TDD , , , , .

, .

0

:

  • , .
  • , , comment-all .
  • , , .

If you do this before or after writing code, this is not so important. Some people say that if you write a test after implementation, you will modify your test to match the implementation, which reduces the effectiveness of unit test.

0
source

Source: https://habr.com/ru/post/1754600/


All Articles