The agile software development philosophy has become a popular choice for organizations, both large and small. Agile’s iterative, incremental, flexible, lightweight and collaborative approach represents a significant departure from traditional development practices yet has proven to be very effective for many development teams.
One of the ideas that has grown out of agile—and the extreme programming methodology, in particular—is the concept of test-driven development. Here’s a look at what test-driven development means and represents and how it’s implemented today in organizations like yours.
What Is Test-Driven Development?
As the name suggests, test-driven development (TDD) refers to a style of software development in which unit tests are written one-by-one before the code. The software is then developed just enough to pass the latest test in the sequence. Once the software passes this test case, developers formulate a new test and the coding-testing cycle continues.
Programmers who use TDD often praise it for its ability to detect bugs quickly and provide insight into the current state and behavior of the program. TDD treats a code base as a set of small, modular, composable units. This means that refactoring a program or adding new features is much easier because the tests will instantly detect any bugs that were introduced during the changes.
However, TDD is time-consuming and only worthwhile if the software unit tests are used extensively throughout development. In addition, TDD alone is insufficient for situations where functional testing is required to assess the application’s performance in production.
Learn more about the best industry estimation techniques in software testing, explained in our blog post.
What Is the Difference Between TDD and Behavior-Driven Development?
Just as agile gave birth to TDD, TDD served as the foundation for the idea of behavior-driven development (BDD). In BDD, developers and other stakeholders describe how they intend for an application to behave in production, then develop the software with these behaviors in mind. These expected behaviors are then converted into validation tests to ensure that the software is performing in accordance with specifications.
Like TDD, BDD emphasizes a progressive, incremental approach to development. Rather than passing “one more test,” however, the developers’ task is to build “one more feature.” In BDD, a developer’s top priority is always to implement the most important thing that the software doesn’t already do in its current state.
How Is TDD Implemented Today?
Within modern software development companies, TDD is typically implemented using automated unit test frameworks which are easily integrated into popular integrated development environments (IDEs).
Modern TDD also benefits from a variety of tools and techniques that make development easier and help maintain the integrity of projects. For example, code coverage tools such as JaCoCo, Atlassian Clover and Cobertura can be used to make sure that the automated software unit testing suite properly tests the entire codebase. Tools for continuous integration, such as Jenkins and Bamboo, are a necessity in order for developers to verify that their code is up-to-date and defect-free.
Test-driven development is a marked departure from the traditional waterfall model of software development, in which all testing occurs only after development has been completed. When used by the right team, however, TDD is not only a viable alternative, but can return massive benefits in terms of speed, efficiency, and productivity.