Test Driven Development
Test Driven Development (TDD) has been evolving as a new paradigm of software development these days. Conventional software development methods suffer from maintenance issues. Because of the “develop then test” approach, they can’t cope with the continuously changing business requirements. A slight modification in application can lead to ripple effects and cause havoc in ways that are impossible to predict. TDD addresses all of these issues by an integrated approach to development. Testing is now part of development, enabling requirement changes to be incorporated at any stage of development. In this article, an overview of TDD is provided. The article talks about TDD, its life cycle, and various automated tools available in market.
So, what is TDD all about? It is simply a software development process that allows developer to code only when an automated test case has failed. Putting in other words, it is the practice of concurrently writing unit test cases and production code at very fine level of granularity. These test cases check whether a particular aspect/ feature of software is working correctly. The advantage of this approach is a complete suite of unit tests (corresponding to user requirements) available after development. These unit tests not only drive the software design, but they can be executed at any time to ensure that the software is working properly.
Life cycle of test driven development
The life cycle of TDD is very simple. It comprises three steps: write test case, code, and re-factor. The developer first writes test case based on the new requirements of user. When run against the software, the test case fails. So, the developer implements the requirement in the simplest possible manner, such that the particular test passes. Before proceeding towards the next test case, code refactoring is also performed. The objective is to simplify the code. By adopting this test, code, and refractor strategy, the production code leads to streamlined communication, confidence, and overall productivity.
The TDD provides several benefits to end user. Testing feedback is available to the developer as soon as a code change is completed and test case is run. This technique also eliminates manual testing steps, and integrates building and testing into unified/ coordinated activity. The biggest advantage of TDD is comprehensive test coverage. If all the rules of TDD are followed, then virtually the whole code is covered by unit tests. The tests can be run any time and any number of times. If a change is made even after the production code, test cases can be re-run to ensure the code hasn’t broken. The code is now easily maintainable and changeable. The test cases also serve as documentation of software and can be reviewed by other programmers to understand the code.
Conclusion