O'Reilly logo

Building APIs with Node.js by Caio Ribeiro Pereira

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

©  Caio Ribeiro Pereira 2016

Caio Ribeiro Pereira, Building APIs with Node.js , 10.1007/978-1-4842-2442-7_8

8. Testing the Application: Part 1

Caio Ribeiro Pereira

(1)São Vicente - SP, São Paulo, Brazil

Creating automated tests is highly recommended. There are several types of tests: unitary, functional, acceptance, and others. This chapter focuses only on the acceptance test, which in our case aims to test the outputs and behaviors of our API’s routes.

To create and execute the tests, it’s necessary to use a test runner. We’ll use Mocha (Figure 8-1), which is very popular in the Node.js community.

A435096_1_En_8_Fig1_HTML.jpg
Figure 8-1. Mocha test runner

Mocha has the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required