Skip to content

Latest commit

 

History

History
94 lines (52 loc) · 2.46 KB

TESTING.md

File metadata and controls

94 lines (52 loc) · 2.46 KB

Testing

All Tests

This script will run both backend and frontend tests

In gitbash:

./run-tests.sh

In powershell:

.\run-tests.sh

Note: will need to press [Ctrl]+[C] after npm tests finish

Frontend tests

The frontend ReactJS application currently has a test of unit tests using Enzyme.

To run these tests, you'll need to enter the frontend Docker container.

In powershell:

docker exec -it project-thundercat_frontend_1 /bin/bash

npm run test

Backend tests

The backend Django application has a set of tests for it's views and uses Postman to manage API tests.

To run the unit tests, you'll need to enter the backend Docker container.

In powershell:

docker exec -it project-thundercat_backend_1 /bin/bash

./manage.py test tests

To run Postman tests, you'll need to launch Postman desktop app and setup your environment.

  1. Import ThunderCAT local environment:

    postman screenshot

    postman screenshot

    postman screenshot

    Then select the following file: \project-thundercat\backend\tests\postman\environments\local\ThunderCAT.local.postman_environment.json.

    You can then put the name of your choice for this new imported environment (e.g. "ThunderCAT - Local").

  2. Make sure that you new environment is selected:

    postman screenshot

  3. Import ThunderCAT collection:

    postman screenshot

    postman screenshot

    Then select the following file: \project-thundercat\backend\tests\postman\ThunderCAT.postman_collection.json.

    You have now your new ThunderCAT collection:

    postman screenshot

  4. You can either run individual tests or run the whole collection:

    Individual test:

    postman screenshot

    Whole collection:

    postman screenshot

    postman screenshot

    Note that if you run the whole collection, you may need to delete some data, since the tests are creating new accounts and you also may need to add authorization for protected APIs.

    postman screenshot