Running tests - CDCgov/prime-simplereport GitHub Wiki

Intro

This page guides you through running the various tests locally.

Unit tests

Run frontend unit tests:

yarn test:frontend

Run backend unit tests:

yarn test:backend

In the backend directory, tests can be run with ./gradlew test. Make sure you do not have SPRING_PROFILES_ACTIVE set in your shell environment.

Running a single test with a full stacktrace can be accomplished by supping the path to ./gradlew test with the --tests flag. Example

./gradlew test --tests gov.cdc.usds.simplereport.api.graphql.QueueManagementTest.updateItemInQueue --stacktrace

E2E tests

To learn how to run E2E tests locally, see this wiki page: E2E tests.

Accessibility tests

SimpleReport leverages axe + cypress in e2e tests to test locally, see this wiki page: Accessibility Auditing

Load Tests

SimpleReport leverages Locust to run its load tests. Locust starts as part of the local development build and spawns three separate worker containers for inundating the system.

To compose Locust with the rest of the development stack, run yarn locust instead of yarn start. (NOTE: All other prerequisites listed in Running outside of Docker or Docker and docker compose development are still required for tests to function.) (EDITOR'S NOTE: check which one should be the prereq)

To access the Locust user interface, navigate to http://localhost:8089/. Load tests will not kick off automatically; they must be manually invoked.

Tests can be configured by modifying backend/locust/locustfile.py.

Smoke tests

You can conduct manual tests in a deployed lower environment. Please look at Cloud Environments for more information on deploying to our lower environments. To set up your Okta permissions for testing, please look at Setting-up-okta.