API Automation Framework using pytest and pytest-bdd
API Automation Framework using pytest
and pytest-bdd
Automated CRUD (i.e., POST
, GET
, PUT
, DELETE
) operations using pytest
and pytest-bdd
requests
pytest
pytest-bdd
In order to get the tests to run locally, you need to install the following pieces of software.
../[PROJECT_DIR]/tests/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install pyenv
, this is a python version manager.~/.bash_profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PATH="$PYENV_ROOT/shims:$PATH"
export PATH="$PYENV_ROOT/completions/pyenv.bash:$PATH"
pyenv install 3.8.13
pyenv global 3.8.13
python3 -m pip install --user virtualenv
python3 -m virtualenv .venv
source ./.venv/bin/activate
pip install -r requirements.txt --use-pep517
which python
, which shall be [PROJECT_DIR]/tests/.venv/bin/python
.pip install -r requirements.txt --use-pep517
bdd-gherkin-test-automation-framework/
├─ .github/
│ ├─ workflows/
│ │ ├─ ci.yml
├─ tests/
│ ├─ data/
│ │ ├─ post_payload_1.json
│ │ ├─ post_payload_2.json
│ │ ├─ put_payload_1.json
│ │ ├─ put_payload_2.json
│ ├─ features/
│ │ ├─ sample.feature
│ ├─ lib/
│ │ ├─ terminal_report.py
│ ├─ step_definitions/
│ │ ├─ test_assertions.py
│ │ ├─ test_common.py
│ │ ├─ test_sample.py
│ ├─ utils/
│ │ ├─ __init__.py
│ │ ├─ custom_exceptions.py
│ │ ├─ logger_config.py
│ │ ├─ utils.py
│ ├─ .env
│ ├─ .gitignore
│ ├─ conftest.py
│ ├─ pytest.ini
│ ├─ requirements.txt
├─ LICENSE
├─ README.md
bdd-gherkin-api-test-automation-framework
git clone https://github.com/<your_github_username>/bdd-gherkin-api-test-automation-framework.git
or via SSH git clone git@github.com:<your_github_username>/bdd-gherkin-api-test-automation-framework.git
../bdd-gherkin-test-automation-framework/tests
)python -m pytest -v --gherkin-terminal-reporter --reruns 1 --reruns-delay 1 --tags="automated" -s --color="yes"
in Terminal
Edit Configurations...
New Configuration
(+
sign) > Python tests
> pytest
Target Script path
and Working directory
(i.e., ../bdd-gherkin-test-automation-framework/tests
)Python interpreter
Additional Arguments
: -v --gherkin-terminal-reporter --reruns 1 --reruns-delay 1 --tags="automated" --color="yes"