|
1 |
| -# api-framework-python |
| 1 | +# API Test Automation Framework with Python |
| 2 | + |
| 3 | +This is a Test Automation Framework with `Python` that is used to automate CRUD APIs |
| 4 | + |
| 5 | +## 🚀 Description: |
| 6 | + |
| 7 | +Automated CRUD (i.e., `POST`, `GET`, `PUT`, `DELETE`) APIs using `python` |
| 8 | + |
| 9 | +## 🚀 Prerequisites: |
| 10 | + |
| 11 | +`requests` `pytest` `assertpy` `python-dotenv` |
| 12 | + |
| 13 | +## 🚀 Project Structure: |
| 14 | + |
| 15 | +```properties |
| 16 | +api-framework-python/ |
| 17 | +├─ clients/ |
| 18 | +│ ├─ restful_booker/ |
| 19 | +│ │ ├─ __init__.py |
| 20 | +│ │ ├─ restful_booker_client.py |
| 21 | +│ ├─ __init__.py |
| 22 | +│ ├─ base_client.py |
| 23 | +├─ tests/ |
| 24 | +│ ├─ data/ |
| 25 | +│ │ ├─ create_booking.json |
| 26 | +│ │ ├─ update_booking.json |
| 27 | +│ ├─ __init__.py |
| 28 | +│ ├─ test_restful_booker_crud_operation.py |
| 29 | +├─ utils/ |
| 30 | +│ ├─ __init__.py |
| 31 | +│ ├─ file_reader.py |
| 32 | +│ ├─ request.py |
| 33 | +├─ .env |
| 34 | +├─ .gitignore |
| 35 | +├─ config.py |
| 36 | +├─ conftest.py |
| 37 | +├─ LICENSE |
| 38 | +├─ Pipfile |
| 39 | +├─ Pipfile.lock |
| 40 | +├─ README.md |
| 41 | +``` |
| 42 | + |
| 43 | +## 🚀 Installation Steps: |
| 44 | + |
| 45 | +- Install `pipenv` via homebrew |
| 46 | + |
| 47 | +```commandline |
| 48 | +brew install pipenv |
| 49 | +``` |
| 50 | + |
| 51 | +- Create a home directory |
| 52 | + |
| 53 | +```commandline |
| 54 | +mkdir ~/.virtualenvs |
| 55 | +``` |
| 56 | + |
| 57 | +- Add below in `~/.zshrc` or `~/.bash_profile` (if on Mac/Linux) or your Windows system variables |
| 58 | + |
| 59 | +```commandline |
| 60 | +export WORKON_HOME=~/virtualenvs |
| 61 | +export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 |
| 62 | +export LANG=en_US.UTF-8 |
| 63 | +export LC_ALL=en_US.UTF-8 |
| 64 | +``` |
| 65 | + |
| 66 | +- Source the above changes |
| 67 | + |
| 68 | +```commandline |
| 69 | +source ~/.zshrc |
| 70 | +``` |
| 71 | + |
| 72 | +- Create a new project using Python 3.8 |
| 73 | + |
| 74 | +```commandline |
| 75 | +pipenv --python 3.8 |
| 76 | +``` |
| 77 | + |
| 78 | +- Activate virtualenv |
| 79 | + |
| 80 | +```commandline |
| 81 | +pipenv shell |
| 82 | +``` |
| 83 | + |
| 84 | +- Install all dependencies in your virtualenv |
| 85 | + |
| 86 | +```commandline |
| 87 | +pipenv install |
| 88 | +``` |
| 89 | + |
| 90 | +## 🚀 Test Execution: |
| 91 | + |
| 92 | +- Fork and Clone the repository https://github.com/ashikkumar23/api-framework-python |
| 93 | +- Open [Pycharm](https://www.jetbrains.com/pycharm/) (or any IDE) > File > Open > Open the project where the repository is located (i.e., `../api-framework-python`) |
| 94 | +- On the `Pycharm` terminal, navigate to the `tests` directory via `cd tests` |
| 95 | +- Make sure a one-time [Installation](https://github.com/ashikkumar23/api-framework-python#-installation-steps) is performed before executing the tests |
| 96 | +- On the `Pycharm` terminal, run the command: `python -m pytest -v` |
0 commit comments