DEV Community

Marius Espejo
Marius Espejo

Posted on

NodeJS Express Test-Driven API Development (TDD)

The idea behind Test-Driven Development is quite simple.

  1. Write a test BEFORE you implement your next bit of functionality

  2. Write the minimal implementation needed to make your test pass

  3. Refactor and re-structure what you've written so far as needed

Then just keep cycling through those 3 steps as you build out the rest of your project!

In the following video, we learn about the basics of Test-Driven Development (TDD) specifically in the landscape of developing APIs. We use ExpressJS, Jest, and supertest as our frameworks of choice here, but the fundamentals that you learn from this video can be applied in almost any scenario, regardless of what NodeJS or testing framework you are using.

Oldest comments (0)