Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Testing

Sheng Tao Tian edited this page May 19, 2023 · 7 revisions

Backend testing

The tests for the backend for each route are seperated per route in their respective folders.
Each route can be tested with the following command:

python backend/manage.py test <folder_name> --with-coverage --cover-package=<folder_name>

There is also a script that will run all the routes that have testing available:

runtests.sh

Both ways of running the tests should output some sort of table with coverage results and end with

Ran X tests in Ys

OK
Destroying test database for alias 'default'...

If somehow, there are mentions of errors or failures, check if your docker instances are built with the latest files and if the database is up-to-date with the latest migrations and data from the dump.

Frontend testing

The tests for the frontend are located in frontend/__tests__ and are written with the jest framework.

You can either run the tests all at once in the frontend docker using the following command:

docker-compose exec frontend npm test 

or run them individually in using your IDE.

When writing tests, please make sure to use the .test.tsx file extension, otherwise jest might not be able to find them.

Clone this wiki locally