Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.72 KB

testing.md

File metadata and controls

60 lines (40 loc) · 1.72 KB

Testing

CALC provides a custom Django management command to run all linters and tests:

docker-compose run app python manage.py ultratest

Python unit tests

To run just unit tests:

docker-compose run app py.test

For more information on running only specific tests, see py.test Usage and Invocations.

Front end tests

For more details on front end testing, see the front end guide.

Integration tests

Some tests use Selenium/WebDriver with Chrome and ChromeDriver to ensure that the back-end and front-end integrate properly. The following environment variables may be useful when configuring these tests:

  • WD_CHROME_ARGS are command-line flags to pass to Chrome, e.g. --headless --no-sandbox --disable-setuid-sandbox.

  • TEST_WITH_ROBOBROWSER is a boolean that indicates whether to run some integration tests using RoboBrowser instead of Selenium/WebDriver. Running tests with RoboBrowser can be much faster and less error-prone than via Selenium, but it also means that the tests are less end-to-end.

  • SKIP_STATIC_ASSET_BUILDING is a boolean that indicates whether to skip the building of front-end static assets before running any integration tests. This can be useful if you need to fix a broken test that doesn't require changing any front-end assets.

Security scans

We use bandit for security-related static analysis.

To run bandit:

docker-compose run app bandit -r .

bandit's configuration is in the .bandit file.