Tests¶
Note
Tests are not included in the installable package. In order to run them you need to clone the whole project first (see Read this first.)
All tests¶
If you plan to execute End-to-End tests, there is a credential setup step to perform before running the whole test suite: copy the file .env.example to .env, and update the contents of the .env file with your credentials.
You can now run all available tests with:
tox
This execution will take some time since it’s running unit and e2e tests, as well as generating documentation. When it’s finished, you should see a message like the following:
py38-unit: commands succeeded
py38-e2e: commands succeeded
unit: commands succeeded
e2e: commands succeeded
docs: commands succeeded
docs-local: commands succeeded
flake8: commands succeeded
congratulations :)
You can modify parameters in tox.ini file, e.g. if you want to show the logging messages, take a look at the log_cli and log_level parameters there.
Unit tests¶
To run unit tests, execute the following command:
tox --recreate -e unit
Besides passing unit tests, the command also generates 2 coverage reports: a terminal print and an HTML report with more detailed info. The HTML report is located at htmlcov/index.html and can be opened with a web browser (e.g. Firefox).
End-to-End tests¶
To run End-to-End tests (also called E2E), execute the following command (remember that you need an .env file locally):
tox --recreate -e e2e
This command also generates 2 coverage reports (terminal and HTML).