Testing, TDD, BDD, and NodeJS

From this chapter on, all the code is considered production code. Thus, having a test suite early on is of paramount importance. We need to ensure high quality and guarantee that when we add new features, all the old functionality keeps working. Furthermore, we want to refactor our code as we go without being afraid that we broke something. Let's introduce TDD (Test Driven Development) and BDD (Behavior Driven Development).

In software terms, TDD is like the double-entry bookkeeping in accounting. Every feature has a double entry, one in the production code and another one in the testing code. It helps us in detecting mistakes quickly and reducing the debug time. It has a very short development cycle:

  1. Write a test and ...

Get Web Application Development with MEAN now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.