Test Driven / Development
February 22, 2016
Alyssa Page
Test driven devlopment is writing tests first and then writing code to make those tests pass instead of the other way around. When a developer wants to add new functionality or an improvement using the test driven development method can produce the minimum amount of code to make the test pass.
First the developer will write a base case test that will fail initially. If it does not fail either the functionality already exists or the test itself does not work. Writing the test first makes sure that the develper understands what the new feature really requires. Next the developer will write code that causes the tests to pass. It does not have to be optimal because refactoring will happen later.
Tests should be run again to make sure all tests pass. This includes the tests for pre existing code to ensure that the new functionality did not break any previous code. When all tests pass, it can be cleaned up and moved to the part of the code structure that it most logically belongs. These steps are repeated each time something is added.
The idea behind test driven development is a shortened development life cycle. It ensures that the developer really understand what the new features are required to do and no excess is being created.