Subscribe by Email


Thursday, May 3, 2012

What is meant by test driven development (TDD)?

Test driven development or TDD is another process in the league of the software development processes. The topic of the test driven development is in the spot light of this article. The test driven development follows from the idea of the repetition of a very short development cycles. 



Concepts of Test Driven Development (TDD)


- First of all a failing automated test case is written or created by the developer or tester which serves the purpose of defining a new function or a desired improvement. 
- Then a code to pass the above created test is also created by the developer. 
- This newly written code is then refactored in order to make it meet the acceptable standards.
- Kent Beck is credited with the discovery of the test driven development process in the year of 2003. 
- The test driven development was looked up as an encouragement for the simple designs and also as an inspiration for boosting up confidence levels.
- The test driven development has always been related to the concepts of the extreme programming which took its root in the year of 1999. 
- But, eventually it came up as an individual process with its own ways and rights. 
- The concepts of the test driven development are also employed by the programmers and developers as a measure for debugging the legacy code and improving it further. 
- The test driven development is driven by a series of automated unit tests that are created by the developer for defining the requirements of the code and then automatically produce the code for them. 
- These unit tests are comprised of assertions i.e., either true values or false values. 
- Successful passing of a test confirms the developer of the correctness of the code and that it can be further evolved and re-factored. 
- To run these automated test cases, the developers make use of the testing frame works.



Steps involved in Test Driven Development (TDD)




Addition of a Test: 
The development begins with the creation of test cases for all the features. These test cases are often expected to fail since they have been created before the implementation of those features. If these test cases do not fail then either the test case is having some defect or the proposed new feature is already in existence. Before writing the test case, the developer is supposed to fully understand the specifications and requirements of the feature using the user stories and use cases etc. This is what that makes the test driven development different from other development methodologies.


Execution of all tests in order to check the working of the new one: 
This step involves the validation of the test harness for its correct working. At this step this is also ensured that the new test is not passing without the requirement of some new code. The test itself is also tested in negative and the possibility that the newly added test will always pass out is reduced. The new test is also expected to fail because of the reason figured out.


Production of code: 
This step involves the creation of some code implementing which the code can only pass the test and does not incorporates any new functionality.


Execution of the automated tests and observing their success.


Re-factoring of code: 
This step involves the cleaning up of the code.


Repetition: 
The whole cycle is repeated for the improvement of the functionalities.


Many development styles have been developed for the test driven development like:
  1. YAGNI (you ain’t gonna need it)
  2. KISS (keep it simple stupid) etc.


No comments:

Facebook activity