Running tests and reports

Running default test suite

The test suite can be run using the tox tool:

poetry run tox

Enabling Selenium browser tests

The test suite contains tests that use Selenium to do browser based tests. They need to be enabled when running the test suite, which can be done by setting certain environment variables:





List of webdrivers to test against, comma-separated.



Address of Selenium hub if using remote grid


Hostname reachable from Selenium for live server


Path to directory to create screenshots in


Selenium tests are enabled if TEST_SELENIUM_BROWSERS is non-empty.

To set variables, use env to wrap the tox ommand:

poetry run env TEST_SELENIUM_BROWSERS=chrome,firefox tox

Using a Selenium hub on local Docker host

One way to setup Selenium is to use the official images on the local machine.

First, get Selenium Hub and one or more browser nodes up and running:

docker run -d -p 4444:4444 --name selenium-hub selenium/hub
docker run -d --link selenium-hub:hub selenium/node-chrome
docker run -d --link selenium-hub:hub selenium/node-firefox

After that, you can run the test suite, setting the needed variables to use Docker Hub:

poetry run env \
  TEST_SELENIUM_BROWSERS=chrome,firefox \

The TEST_HOST variable is set to the Docker host’s IP address, where the Selenium nodes can access Django’s live server. Django automatically configures the live server to be reachable if a Selenium hub is used.

Taking screenshots

The browser test suites automatically take screenshots at certain steps if enabled in the test run. This can be used to visually verify that views look like they should or for documentation purposes.

To enable screenshots, add the TEST_SCREENSHOT_PATH environment variable when running the tests.

If runnin multiple browsers, screenshots are placed in separate directories per browser.