Yandex Taxi Testsuite
What is testsuite
Testsuite is a microservice-oriented test framework written in Python based on pytest.
Testsuite is written and supported by Yandex.Taxi, and is used to test Yandex.Taxi microservices written in C++ and Python.
The principal suggested approach to testing - although not the only one - is black box, when the service is tested through http calls.
Direct read and write access from test to database is supported to enable precondition setup and result assertions.
Installation
Installation using pip:
pip3 install yandex-taxi-testsuite
# testsuite with mongodb support
pip3 install yandex-taxi-testsuite[mongodb]
# testsuite with postgresql support
pip3 install yandex-taxi-testsuite[postgresql]
pip3 install yandex-taxi-testsuite[postgresql-binary]
# testsuite with redis support
pip3 install yandex-taxi-testsuite[redis]
# testsuite with mysql support
pip3 install yandex-taxi-testsuite[mysql]
# testsuite with clickhouse support
pip3 install yandex-taxi-testsuite[clickhouse]
# testsuite with rabbitmq support
pip3 install yandex-taxi-testsuite[rabbitmq]
# testsuite with kafka support
pip3 install yandex-taxi-testsuite[kafka]
# testsuite with protobuf support
pip3 install yandex-taxi-testsuite[protobuf]
Supported databases
Out-of-the-box testsuite supports the following databases:
PostgreSQL
MongoDB
Redis/Valkey
MySQL/MariaDB 10+
ClickHouse
RabbitMQ
Supported operating systems
Testsuite runs on GNU/Linux and macOS operating systems.
Principle of operation
Testsuite sets up the environment for the service being tested:
Testsuite starts any required databases (postgresql, mongo, redis).
Before each test, testsuite fills the database with test data.
Testsuite starts its own web server (mockserver), which mimics (mocks) microservices other than the one being tested.
Testsuite starts the microservice being tested in a separate process.
Testsuite then runs tests.
A test performs http requests to the service and verifies that the requests were processed properly.
A test may check the results of an http call by looking directly into the service’s database.
A test may check whether the service has made calls to external services, as well as the order of calls and the data that was sent and received.
A test may check the internal state of the service as represented by the data the service sent to the test with the testpoint mechanism.
Source code
Testsuite open-source edition code is available here.
Documentation
For full documentation, including installation, tutorials, please see https://yandex.github.io/yandex-taxi-testsuite/.
Running testsuite
self-tests:
pytest3 ./tests
tests of example services:
cd docs/examples && make
Development
Setup virtual env
In order to test your modifications it’s useful to run testsuite inside virtualenv. Use the following command to create developer’s venv:
make setup-dev-venv
Virtualenv will be created in .venv-dev directory.
Code format and linters
Auto format source code:
make venv-format
Run linters:
make venv-check-linters
make venv-check-mypy
You can also add pre-commit hook which will run ruff and linters for you:
make install-pre-commit-hooks
Running tests
You can run tests using Makefile:
make venv-tests
Or directly using pytest:
make setup-dev-venv # Setup virtual env first
. .venv-dev/bin/activate # Activate virtualenv
pytest -vv tests/plugins/mockserver # Finally run pytest
Building documentation
make build-docs
Contributing
Fork project
Write code in your own branch
Test your code
Run linters and code formatters
Create pull request on github
Release files for yandex-taxi-testsuite 0.4.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yandex_taxi_testsuite-0.4.11.tar.gz | 115.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yandex_taxi_testsuite-0.4.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 265.8 kB
Release files / yandex_taxi_testsuite-0.4.11.tar.gz
| Download URL | yandex_taxi_testsuite-0.4.11.tar.gz |
|---|---|
| Size | 115.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
888631b04425269cbbdb09d9e5f9dab459b22c3836f8593167ede0a3bbb46b9f
|
|
BLAKE2b-256 checksum How to use checksums |
e56fc0cf924aa6a6219fb21932ee8d45980944f719e8764e6efbb97979cfa343
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / yandex_taxi_testsuite-0.4.11-py3-none-any.whl
| Download URL | yandex_taxi_testsuite-0.4.11-py3-none-any.whl |
|---|---|
| Size | 150.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bc341102632a134de773adf2bec7f060550645aa641118abd337b52a67fa3db
|
|
BLAKE2b-256 checksum How to use checksums |
e6720e2c3c1260c3c742f908315ccf37e119c092da0019228aed6d98fe9d0b71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|