Test Driven Developement
Cycle
Add a test
Run all tests and see if the new one fails
Write some code
Run tests
Refactor code
Repeat
Why
Immediate feedback (bugs are found earlier)
Make sure you don't break previous code
Help refactor code (don't have to worry too much) ex. better policy
Why Not
(from Stackoverflow)
Big time investment
Additional Complexity
Design isn't clear at first
Practice
Create a folder and add following files:
index.html
tests.js
Then, let's start to edit main.js
! Our goal is to write unit tests first and implement main.js to pass all the tests.
Reference
Last updated
Was this helpful?