Skip to content

Testing (Backend)

Lucy Chen edited this page Mar 20, 2020 · 3 revisions

Testing of Schema

Unit tests for our Schemas were written using the Mocha framework.

The tests can be run with npm test in the terminal.

Testing of API

Postman Collections and Test scripts were used to test our APIs.

The current Doto collection can be accessed here: https://www.getpostman.com/collections/17c539bc0fe909d838cf

This collection can be imported into Postman by using the link above.

Guide to testing with authorisation in Postman

  1. Have Doto web app running.
  2. Sign in using Google.
  3. Find accessToken= in the URL and copy everything after =
  4. When making a request through Postman, navigate to the Headers tab.
  5. Follow the table below, replacing YOUR_ACCESS_TOKEN with the access token copied before.
Key Value Description
Authorization Bearer YOUR_ACCESS_TOKEN

Testing of Database schema

We use Mocha to test our database schema for User and Task. It runs well with Node, and supports asynchronous testing.

All our tests are added in the 'test' directory within the backend directory. they have 'test' in the filename so that mocha knows to run these tests.

Clone this wiki locally