- Clone the repository
- Install the required packages using the following command:
pip install -r requirements.txt
To run the tests, use the following command:
pytest
To run the tests in parallel, use the following command:
pytest -n <number_of_workers>
Pytest generates an Allure report after running the tests. To view the report, use the following command:
allure serve allure-results
The test cases are located in the tests
directory. Pull of the test cases are located in the file.
The repository has the following structure:
- tests: Contains the test cases
- src: Contains the functions that are used in the tests (api, helpers, assertions, etc.)
- allure-results: Contains the Allure report results
- requirements.txt: Contains the required packages
- pytest.ini: Contains the pytest configuration
- README.md: Contains the repository description
- .gitignore: Contains the files and directories that are ignored by Git
- docker-compose.yml: Contains the Docker Compose configuration
- Dockerfile: Contains the Docker configuration
To run the tests in a Docker container, use the following command:
docker-compose up
or
docker build -t petstore-api-tests .
docker run petstore-api-tests
To run pre-commit hooks from .pre-commit-config.yaml, use the following command:
pre-commit run --all-files
ruff, black, isort with pyproject.toml config
- ruff:
ruff check .
- black:
black .
- isort:
isort .
automatically fix with --fix
flag
- ruff:
ruff --fix .
Interrogate can be added to the pre-commit hooks to check for docstrings in the code.
To run Interrogate solo, use the following command:
- `interrogate -v -e .\tests\ .`