Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Unit and System tests

Ricky Bassom edited this page Dec 23, 2020 · 3 revisions

Unit tests

Philosophy

When developing for Autoreduction please ensure new code you add or old code you change has unit test cases that cover it. The ideal scenario would be to use Test Driven Development, but this is not always easy to do, so use when appropriate.

Test settings

Unit tests should aim to use the test_settings.py values. GitHub Actions, before running unit tests copies the test_settings.py file to settings.py allowing autoreduction to use these settings. For more information on this see details on migrate test settings.

Location

Unit tests should be kept with their code. For example the utils/clients has an inner folder called tests (utils/clients/tests) and this is where the unit tests should be. Pytest will pick these files up providing the naming convention test_ prefix is followed for the testing file. Unit tests for autoreduction are written using the standard python unit testing framework unittest

System tests

System tests are stored in the systemtest/ directory at the top level of the repository. These are designed to test flow between different parts of the system and should be used to validate the system as a whole rather than small sections (unit tests).

Updating GitHub Actions

If changing unit tests, be sure to update the .github/workflows/run-test.yml file to include these tests. In the majority of cases these should be picked up automatically, but do check that your tests have been run in the GitHub Actions output to be sure.

Clone this wiki locally