Test framework written in python as demo for testing RESTful API of https://swapi.dev/
Run script
test.sh
- Create virtual env
python3 -m venv env
- Activate env
source env/bin/activate
- Install required packages
pip install -r requirements.txt
- Run pytest
pytest --alluredir=./reports/allure_results
- Generate report
allure serve ./reports/allure_results
- Python 3.9 and higher
- pytest
- pytest-timeout
- requests
- allure-pytest for reports
There is plenty room for refactor I could:
- extract asserts to some helper module .e.g new folder/package helpers > asserts.py etc
- handle better constants.py to use and store data need it by tests
- add more negative tests around each endpoint
- test full content of response bodies returned by service
- etc..
It took me around 2 working days, of which half day I've tried to implement pytest-bdd but I didn't continue with that.