In the field of software engineering, there are numerous methodologies and approaches available to carry out the software development process. Almost in all these development model, development is followed by testing, i.e. a fixed pattern or standard is set to first implement the requirements in the development phase to output a build, version or a partially developed or completely developed product, which undergoes through the testing process and subsequently delivering the final product of desired quality.However, there also exists one more type of development approach or model, where testing is followed by the development, i.e. testing drives the development process and is known by the name of Test Driven Development.
It is a specific approach of carrying out the development process, where testing is done first and its output decides and drives the development process. It is one of the agile methodologies of software development, where the test cases for a particular code, functionality or feature, is written and executed, before deploying and implementing that code. The basic working of TDD involves writing the test first based on the specified requirement and restructuring and improving the code quality to pass these test.
Abbreviated as TDD, in test-driven development, requirements are implemented in the form of test cases to cover each of the functionality and features. The tests are executed and accordingly the code is refactored or improved on the failure of its corresponding test cases and subsequently the improved code is made to pass through the new test(for other different functionality). Thus, TDD involves the repetition of cycles until the codes are enhanced to pass each design test.
The complete process of developing a software product using the TDD approach may be seen as a repetition of multiple cycles, where each cycle comprises of following activities in a subsequent manner:
This phase, involves the study and analysis of the requirements and specifications, for each functionality/feature or modified functionality by the developers through the usage of use case and user stories, to ensure the complete coverage of each requirement and functionality.
Verify and validate the desired and appropriate working of the test harness suite. The test created in the previous stage is examined to ensure that it does not get passed, without the availability of the code. Further, it is also evaluated that the test does not passes always, rather it should fail also on encountering with specific conditions or circumstances.
During this stage, codes are written, to pass the tests. The emphasize is made on writing the code, in such a manner, that it successfully passes the test, and simultaneously overlooking the quality aspect. However, the quality of the code is gradually enhanced, after each iteration.
All the developed test cases are executed in this stage, and if the code passes these entire tests, then the code is said to be ready and is in compliance with the specified requirements and specifications.
As the code, has already passed the tests this stage ensures the cleaning and bringing improvement in the code, adding more functionality and features, removing duplication and many such things, in the direction of enhancing the quality of the code. Thereafter, re-executing the test to ensure that the code is still passing the test after the process of code refactoring.
The whole cycle is repeated to consider other different requirements/ specification and accordingly following the previously stated 5 phases to produce the code of desired quality fulfilling the specified requirement.
Test-Driven Development may be carried out, using two different approaches, as mentioned below:
All teams and individuals involved in software development communicate with each other, which enables them to have accurate and detailed knowledge of the product and subsequently decides the acceptance criteria from the user's perspective based on which acceptance tests are created and similar activities as applicable in TDD, is being carried out further to drive the development process. It is pertinent to mention that the acceptance test may be used, to derive the developer tests.
It's a test driven development, where the unit test or developer test is being created, and subsequently, the code is produced, to pass these tests. This already, has been discussed in detail.
Below given, are some of the tools and framework, readily available in the market, for test-driven development.
Advertisement: