- python 3.8+
- dependencies from requirements_smoke.txt
- all required env vars exported (e.g. using Convenience shell scripts)
IMPORTANT NOTE
Majority of smoke
tests use requests
library to talk to DIT services and APIs.
Some of tests also use: directory_cms_client
or directory_sso_api_client
.
Secrets such as API keys and service URLs are specified in env.json.
You'll need to export all of them to your shell as environment variables prior to running smoke tests.
For more instructions please refer to Env Vars
section of project's main README.
Furthermore, you can control the execution of smoke tests with PYTEST_ARGS
env var.
It is an optional variable that is used to filter out tests which you don't want to run.
Before running smoke tests against lets say DEV test environment you want to enable venv and export env vars:
- Enable venv for smoke tests (
workon
command is part of virtualenvwrapper package)workon smoke
- Export env vars with
dir-dev.sh
convenience script# if you configured an alias then: dev # or source directly with: source ~/dir-dev.sh
To run smoke tests against specific TEST_ENV
choose one of the following options:
TEST_ENV=DEV PYTEST_ARGS='-m "not stage and not uat and not prod"' make smoke_tests
TEST_ENV=STAGE PYTEST_ARGS='-m "not dev and not uat and not prod"' make smoke_tests
TEST_ENV=UAT PYTEST_ARGS='-m "not dev and not stage and not prod"' make smoke_tests
TEST_ENV=PROD PYTEST_ARGS='-m "not dev and not stage and not uat"' make smoke_tests
You can also use pytest
command to run smoke tests:
pytest tests/smoke/test_sitemaps.py
This will run all tests from selected module (even those that should be skipped).
If you'd like to skip tests that are not meant to be run against currently selected environment,
then use -m
argument to filter them out, i.e.:
pytest tests/smoke/test_cms.py -m "not stage and not prod"
To get a bit better out from pytests
run it with --capture=no --verbose
:
pytest --capture=no --verbose tests/smoke/test_sitemaps.py