Testing our code ensures that it always runs correctly, and helps us prevent introducing extra bugs when adding or changing features. Although it seems daunting at first, we'll see that unit testing is actually pretty easy to do.
Why are we doing unit testing ?
When developing, the complexity of our code can grow too big for us to be able to hold it all in our heads. Also, adding new features carries with it the risk of breaking old, working functionality.
Having tests functions like a safety net - it helps us ensure that our code works correctly, and avoids the risk of us deploying a broken version to a production server.