50 likes | 176 Views
Test-Driven Development. Three Rules . Don’t write any production code until you have written a failing unit test. Don’t write more of a unit test than is sufficient to fail or fail to compile Don’t write any more production code than is sufficient to pass the failing test. Advantages.
E N D
Three Rules • Don’t write any production code until you have written a failing unit test. • Don’t write more of a unit test than is sufficient to fail or fail to compile • Don’t write any more production code than is sufficient to pass the failing test.
Advantages • All program functions are testable and have tests that verify their operation. • We can tell when we break something. • We see the function from the caller’s point of view. • The function will be “conveniently callable.” • Because the function is callable, we have decoupled it from other system software – e.g., the user interface. • Test provides documentation in the form of a working example.