In TDD the test always fails at the start because
A) The quality of Code is bad
B) The developers don’t know the functionality
C) The developers can not test
D) There is no code
In TDD the test always fails at the start because
A) The quality of Code is bad
B) The developers don’t know the functionality
C) The developers can not test
D) There is no code
D) There is no code
This is the one and only correct answer because the idea of TDD is that you only implement code for which you have a failing test. It prevents you from implementing things you do not yet need. This comes from one of the ExtremeProgramming practises YAGNI.
One way XP’ers would keep themselves honest is to insist they write a failing unit test (demonstrating the need for complexity) BEFORE adding the extra complexity to the system.
Failing test example:
Steps for a failing tests are:
Now you can start writing your code.
Background from the XP website:
When you create your tests first, before the code, you will find it much easier and faster to create your code.
Creating a unit test helps a developer to really consider what needs to be done. Requirements are nailed down firmly by tests. There can be no misunderstanding a specification written in the form of executable code.
Learning & practise TDD:
Anyone interested in TDD should watch the theory and practise the examples described in the Coding Dojo TDD PluralSight video, preferable in a group setting. It will learn you which skills are required for TDD and practise them.
The learning starts with TDD kata's like the string calculator and or the bowling game.
Other reads:
TDD, test driven development. From my personal experiences, it has the following characteristics:
A) The quality of Code is bad
B) The developers don’t know the functionality
C) The developers can not test
D) There is no code
My money is on B