End to end tests written in Python unittest framework using selenium and mysql modules that test complete flows of the szczepienia.pw web application.
This test suite assumes that there is a working:
- szczepienia.pw frontend;
- szczepienia.pw backend;
- mysql server with an initialized database
at a specified address.
Before running the test, some parameters have to be specified:
- frontend url;
- backend url;
- mysql server host;
- mysql server user and password;
- database name.
Those params can be provided in two ways:
- by editing the
default.json
file; - by using commandline arguments - those override settings from
defaults.json
.
--front_url
- frontend url--back_url
- backend url--db_address
- mysql server hostname--db_user
- database user--db_passwd
- database password--db_name
- database name--headless
|--no-headless
- indicate headless/non-headless mode
All the commandline arguments from the unittest
framework can be used as well. Unknown arguments will cause errors in the unittest
framework. Please find all additional information using:
python ./szczepienia.test.py --help
To run all tests execute:
python3 ./szczepienia.test.py
[NOT RECOMMENDED]
It is also possible to run all the test in a way enabled by the unittest
framework:
python3 -m unittest
however this way is highly not recommended - defaults are loaded from defaults.json
and no commandline arguments other than those from the unittest
framework take effect.
It is possible to run only a chosen test suite, or a chosen test.
-
Running a chosen suite:
python3 ./szczepienia.test.py TestSuiteName
e.g.:
python3 ./szczepienia.test.py AdminTests
-
Running a chosen test:
python3 ./szczepienia.test.py TestSuiteName.test_name
e.g.:
python3 ./szczepienia.test.py AdminTests.test01_admin_login
- Every test suite should be in a separate file, named
test_*.py
. Each test suite is a separate class, inherited from theunittest
base class. It should be named*Tests
. - Every test's name has to start with a
test*_
prefix. - It is recommended to impose an order in which the tests will be executed, in order to do so please use prefixes:
test01_
,test02_
, etc. for the test names.
Those tests are to be included in our CI/CD pipelines by the end of the fourth sprint.