Skip to content

"A scalable, modular and user-friendly API automation framework built with Python for testing RESTful APIs."

License

NotificationsYou must be signed in to change notification settings

ashikkumar23/api-framework-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Test Automation Framework with Python

This is a Test Automation Framework with Python that is used to automate CRUD APIs

πŸš€ Description:

Automated CRUD (i.e., POST, GET, PUT, DELETE) APIs using python

πŸš€ Prerequisites:

requests pytest assertpy python-dotenv

πŸš€ Project Structure:

api-framework-python/
β”œβ”€ services/
β”‚  β”œβ”€ restful_booker/
β”‚  β”‚  β”œβ”€ __init__.py
β”‚  β”‚  β”œβ”€ restful_booker_service.py
β”‚  β”œβ”€ __init__.py
β”‚  β”œβ”€ base_service.py
β”œβ”€ tests/
β”‚  β”œβ”€ data/
β”‚  β”‚  β”œβ”€ create_booking.json
β”‚  β”‚  β”œβ”€ update_booking.json
β”‚  β”œβ”€ __init__.py
β”‚  β”œβ”€ test_restful_booker_crud_operation.py
β”œβ”€ utils/
β”‚  β”œβ”€ __init__.py
β”‚  β”œβ”€ file_reader.py
β”‚  β”œβ”€ request.py
β”œβ”€ .env
β”œβ”€ .gitignore
β”œβ”€ config.py
β”œβ”€ conftest.py
β”œβ”€ LICENSE
β”œβ”€ Pipfile
β”œβ”€ Pipfile.lock
β”œβ”€ README.md

πŸš€ Test Execution:

  • Fork and Clone the repository https://.com/ashikkumar23/api-framework-python
  • Open Pycharm (or any IDE) > File > Open > Open the project where the repository is located (i.e., ../api-framework-python)
  • On the Pycharm terminal, navigate to the tests directory via cd tests
  • Make sure a one-time Installation is performed before executing the tests
  • On the Pycharm terminal, run the command: python -m pytest -v

πŸš€ Installation Steps:

  • For Mac: Install pipenv via homebrew
brew install pipenv
  • For Windows: Install pipenv via pip
pip install pipenv
  • Create a home directory
mkdir ~/.virtualenvs
  • Add below in ~/.zshrc or ~/.bash_profile (if on Mac/Linux) or your Windows system variables
export WORKON_HOME=~/virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
  • Source the above changes
source ~/.zshrc
  • Create a new project using Python 3.8
pipenv --python 3.8
  • Activate virtualenv
pipenv shell
  • Install all dependencies in your virtualenv
pipenv install