Subscribe by Email

Thursday, May 3, 2012

What are the requirements in a test driven development?

The test driven development is often abbreviated as “TDD” and has been recognised as one of the common development strategies that are quite popular among the developers and the programmers. 

What is a Test Driven Development?
- This development methodology involves the repetition of short typical development cycles.
- These development cycles are shorter in duration when compared to the usual development cycles of the other software development strategies.
- The developer first requires writing a failing automated test case defining a desired new function or an improvement in an already existing function. 
- A code is then written to pass the test and later it is subjected to refactorization to meet the acceptable standards. 
- Test driven development is often considered to be related to the extreme programming to some extent.
But, now it is being considered as a development process of its own rules and objectives.
- The test driven development also serves to improve and debug the legacy code that has been developed using the other methodologies. 

No development methodology can be carried out further without requirements, this holds true for the test driven development also. This article emphasize on the requirements of the test driven development. 

Requirements in a Test Driven Development
- The whole methodology of test driven development is supported by a set of unit tests that are automated. 
These automated test cases are written in order to define the requirements of a particular piece of the code. 
- Such unit tests first identify the requirements and then immediately write down the code for the identified requirements all by themselves. 
- Certain assertions i.e., the true and false values are also contained in those automated unit tests. 
- The code is continually evolved and re-factorized and then subjected to testing via the automated unit tests which are put up on an automated testing frame work such as xUnit.
- Such frame works facilitate the automatic execution of the unit tests.
- These small unit tests drive the development of a small fragment of the solution.
- These unit tests also serve a tested and canonical documentation for the usage of the program’s object. 
- In the test driven development, writing the test is given the first preference rather than writing the code first. - But, this approach is considered to be difficult by many of the software programmers and developers and even some resist the use of the test driven development methodology since for them it turns out for them as the upside down approach for development.
- The test driven development methodology takes in to consideration the fact that the test is the rightmost important thing and it is required that we make sure that the test passes. 

But what is to be done if the unit tests itself are wrong and do not suffice for providing adequate coverage to the code? 

- If it is the latter case i.e., if the tests are not able to provide enough coverage then there is one possibility that your unit tests are missing out some of the requirements of the code. 
- This often happens in the case of manual testing but not so when we use the automation techniques.
- Automated unit tests make sure that no requirement of the code is left uncovered.
- So, the quality of the unit tests defines the quality of the whole test driven development process also. 

Starting with the requirements is known as the top down approach and is more commonly followed than the bottom up approach. The requirements are treated as the executable tests which are clarified by the managers, stake holders and developers. 

No comments:

Facebook activity