Test-first development is the most important innovation in XP.
• Test-first development requires there to be a clear relationship between system requirements and the code implementation.
• Writing tests first implicitly define the both an interface and specification of behaviour for the functionality being developed.
• It is a test-first programming of the process of the writing tests and in the production of the system requirements.
• Problems of requirements and interface misunderstanding are reduced.
Yes, Test-first development helps the programmer to develop a better understanding of the system requirements:
• Test-first development helps with understanding the requirements to discover what is intended.
• Writing tests are sometimes impossible because the requirements are impossible.
• Writing tests before code clarifies the requirements to be implemented.
• Tests are written as a program that has to be executed correctly.
• In test-first development, each scenario is assessed and breaks down as tasks; each task represents the feature of the system.
• It was very useful to compare the effort spent on the program by the programmers at the time of debugging.
• If some bugs pop-up on debugging, the same test can be useful to capture that again and again.
So, test-first development supports the programmer to develop a well kind of the system requirements.
Difficulties with test-first development:
• Some of the difficulties are comes up with the programmers, they prefer programming to testing and sometimes they take shortcuts when writing tests.
• While programming, it is difficult to predict how long debugging will take place, sometimes the debugging efforts are wasted.
• Also, when the user fixes the bug in a debugging, sometimes the analysis is essentially lost.
• It is difficult to write tests, it leads to complex user interface that decreases the workflow of the program in a system.
• Developers writing tests for better encoding to testing at times they use shortcuts.
o For example, if developer may not write complete tests, then do not check to all exception cases.
• To write the incremental test development is very hard in sometimes. May not be reach customer needs in less time.
• Test-first development is tough to justice the comprehensiveness of a set of tests. While these tests not possible to coverage to entire cases of system.
• So, if the tests are not reviewed and further tests written after development, then undetected bugs may be delivered in the system release.
The main problem with the test-first development is, some tests are very difficult to write because it requires the system infrastructure is needed before anything can be tested.