Test suite for Open Brewery DB API (https://www.openbrewerydb.org/).
The openbrewerydb-api-tests project provides several test suites for api https://www.openbrewerydb.org/). The project is based on the pytest framework with the pytest-html plugin. To validate the data, the marshmallow library is used. API requests are sent using the requests library.
Clone the project and go inside the project directory.
$ git clone git@github.com:vshagur/openbrewerydb-api-tests.git
$ cd openbrewerydb-api-tests/
Create a virtual environment.
$ python3.6 -m venv .env
$ source .env/bin/activate
Install the dependencies.
$ pip install pip --upgrade
$ pip install -r requirements.txt
The test suite checks the main characteristics of the api response - status response code, headers, response format. This test suite can be used as a smoke test.
$ python -m pytest openbrewerydb_api_tests/tests/test_api_base.py
The project defines additional command line interface options. You can set a delay between requests and specify the api address.
Keys:
--delay - the delay between requests to the server,
--url - the base URL (you can run tests on a local server)
To save the test report in the html file, use the key:
--html - the file with test results
An example of running tests using parameters:
$ python -m pytest --html=report.html --url="https://api.openbrewerydb.org/" --delay=0.1 openbrewerydb_api_tests/tests/test_api_base.py
Validating data filtering in API responses.
$ python -m pytest --html=report.html --url="https://api.openbrewerydb.org/" --delay=0.1 openbrewerydb_api_tests/tests/test_api_filter.py
Validation of API responses to search queries.
$ python -m pytest --html=report.html --url="https://api.openbrewerydb.org/" --delay=0.1 openbrewerydb_api_tests/tests/test_api_search.py
The test suite checks API sorting functionality.
$ python -m pytest --html=report.html --url="https://api.openbrewerydb.org/" --delay=0.1 openbrewerydb_api_tests/tests/test_api_sorting.py
Check API completion capabilities.
$ python -m pytest --html=report.html --url="https://api.openbrewerydb.org/" --delay=0.1 openbrewerydb_api_tests/tests/test_api_autocomplete.py
To run all test suites with saving test reports in html files, you can use the run_tests.sh script
$ ./run_tests.sh
- Valeriy Shagur - vshagur, email: vshagur@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details