Test-Last Development involves writing tests after writing the code to support the requirements for a particular task. They exercise the system as it has already been built.
-> After every small step write a developer test using your tool of choice to exercise the code that you have written.
->Do not check any code into the source repository that has not been fully tested.
-> The "testability" will drive a design that has far less coupling than code written without this in mind
-> less effective than Test-First Development but easier to adopt
-- Testing is dropped during crunch time
-- Testing is seen as an overhead
-- Tests are biased towards the solution
Test-First Development involves writing tests before writing the production code that will support and eventually pass that test. Tests resulting from this practice tend to be a developer’s
understanding of requirements because there is no "design" at its inception.
-> Test-First development is more effective and harder to adopt
-> You want to have full test coverage of your requirements instead of test coverage of the design
- Tests that are written after the code are more likely not to be written
- A developer writing production code keeps the fact that he must be able to test this code in the back of his head while developing.
- A developer test should verify that the production code written satisfies the requirements
- Tests written after code may or may not test all of the requirements that drove that code to be written.
- write tests based on requirements (Your test therefore will mirror these requirements)
- we decide the design and needed classes to pass all these tests (The test you wrote earlier will drive the creation of classes, methods on those classes, and their relationships to other classes in your system)
- you only write the code needed to make that test pass.
- You have not written one line of code that has not been driven by requirements.
- The last step is to Refactor—that is to modify the structure of your code without changing its behavior.