Approaches to Agile Testing - Part 3- Test-Driven Development
Test-driven development is one of the core practices of Extreme Programming
. The practice extends the feedback approach, and requires that you develop test cases before you develop code. Developers develop functionality to pass the existing test cases.
The test team then adds new test cases to test the existing functionality, and runs the entire test suite to ensure that the code fails (either because the existing functionality needs to be modified or because required functionality is not yet included). The developers then modify the functionality or create new functionality so that the code can withstand the failed test cases. This cycle continues until the test code passes all of the test cases that the team can create. The developers then refactor the functional code to remove any duplicate or dead code and make it more maintainable and extensible.
Test-driven development reverses the traditional development process. Instead of writing functional code first and then testing it, the team writes the test code before the functional code. The team does this in very small stepsone test and a small amount of corresponding functional code at a time. The developers do not write code for new functionality until a test fails because some functionality is not present. Only when a test is in place do developers do the work required to ensure that the test cases in the test suite pass. In subsequent iterations, when the team has the updated code and another set of test cases, the code may break several existing tests as well as the new tests. The developers continue to develop or modify the functionality to pass all of the test cases.
Test-driven development allows you to start with an unclear set of requirements and relies on the feedback loop between the developers and the customers for input on the requirements. The customer or a customer representative is the part of the core team and immediately provides feedback about the functionality. This practice ensures that the requirements evolve over the course of the project cycle. Testing before writing functional code ensures that the functional code addresses all of the requirements, without including unnecessary functionality.
With test-driven development, you do not need to have a well-defined architectural design before beginning the development phase, as you do with traditional development life cycle methodologies. Test-driven development allows you to tackle smaller problems first and then evolve the system as the requirements become more clear later in the project cycle.
Other advantages of
test-driven development are as follows:
1. Test-driven development promotes loosely coupled and highly cohesive code, because the functionality is evolved in small steps. Each piece of the functionality needs to be self-sufficient in terms of the helper classes and the data that it acts on so that it can be successfully tested in isolation.
2. The test suite acts as documentation for the functional specification of the final system.
3. The system uses automated tests, which significantly reduce the time taken to retest the existing functionality for each new build of the system.
4. When a test fails, you have a clear idea of the tasks that you must perform to resolve the problem. You also have a clear measure of success when the test no longer fails. This increases your confidence that the system actually meets the customer requirements.
Test-driven development helps ensure that your source code is thoroughly unit tested. However, you still need to consider traditional testing techniques, such as functional testing, user acceptance testing, and system integration testing. Much of this testing can also be done early in your project. In fact, in
Extreme Programming, the acceptance tests for a user story are specified by the project stakeholder(s) either before or in parallel to the code being written, giving stakeholders the confidence that the system meets their requirements.
Approaches to Agile Testing - Part 3- Test-Driven Development
By: Austin Craig
Can Bodily Treatment Help Back Ache? Beaches in Nerja Beaches in Pollenca English Bachelor - A Common Method For Linguistic Workout Routines To Build Muscle In 4 Easy Steps Finding An Mlm Leader That Can Help You Acheive Your Goals Nine Essential Approaches To Achieve Great Cause Headache Season is Back! MIGRAINE- LEAVE THE HEADACHE TO AYURVEDA Cause and Treatment of Migraine Headaches Visit Lagos Beaches, Where The Sand And The Ocean Get Lost In The Horizon! Two top approaches to link building Volunteer In Mexico S Wild Beaches, Culture And Nature