This test project aims to cover at least the following scenarios:
- Connect to a exchange (let's call it X-Change) public API
- Retrieve a server time and validate response;
- Retrieve some trading pair and validate response;
- Connect to a private API
- Correctly handle 2fa requirements;
- Retrieve open orders on the account and validate response;
- Report test results
Cucumber feature files are located in ./tests/features
directory.
Cucumber main function is defined under ./tests/xchange.rs
You need to set a number of env vars in order to make tests work.
You can use ./.env.example
file as a template (cp ./.env.example .env
)
API_URL
- API url, e.g.https://api.xchange.com
API_KEY
- your API keyPRIV_KEY
- your API private keyTFA_PASSWORD
- a static 2fa password for API calls
cargo test --lib
cargo test --test xchange
The project is Dockerized so it is also possible to run tests using Docker compose. In addition a Allure report is generated with tests results.
Assuming you have .env
file set up in your project's root folder run the following command (note docker-compose
can read .env
files):
docker-compose up --build
Thus you will execute all Cucumber tests and Allure server will be launched. Now you can navigate to http://localhost:8080
to check the report.
A Github Actions workflow is also configured for a project. Here you will find a status of latest runs.