Why Test-Driven Development and Jest
Get introduced to test-driven development, Jest, and other libraries used throughout the course.
Most tests are an afterthought. A programmer writes hundreds of lines of code to add a new feature to an application, followed by a perfunctory test or two. This “test-later” way of working has several drawbacks.
Drawbacks of writing tests after implementing features
Following are the drawbacks of writing tests after implementing the features:
-
Without tests, the programmer receives no feedback while writing the feature. If their approach turns out to be a dead-end, they won’t know it until they’ve finished the entire implementation.
-
The tests the programmer writes after implementing the feature tend to be unthorough and unimaginative. Typically they confirm that the feature
works along the “happy path.” In other words, when used exactly as anticipated, rather than revealing potential bugs that ...