GithubHelp home page GithubHelp logo

ashikkumar23 / gherkin-bdd-api-test-framework Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 4.0 1.44 MB

"A repository featuring a BDD-based automation framework for efficient API testing using the user-friendly Gherkin syntax and BDD principles."

License: GNU General Public License v3.0

Python 87.01% Gherkin 12.99%
bdd-gherkin pytest pytest-bdd python api-automation github github-actions rest-api test-automation requests

gherkin-bdd-api-test-framework's Introduction

API Automation Framework

Actions Status

API Automation Framework using pytest and pytest-bdd

๐Ÿš€ Description:

Automated CRUD (i.e., POST, GET, PUT, DELETE) operations using pytest and pytest-bdd

๐Ÿš€ Prerequisites:

requests pytest pytest-bdd

๐Ÿš€ Installation Steps:

In order to get the tests to run locally, you need to install the following pieces of software.

NOTE: All commands shall be executed from Automation Project root directory: ../[PROJECT_DIR]/tests/

MacOS

  • Install Homebrew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install Pyenv with brew install pyenv, this is a python version manager.
  • Add the following to ~/.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"
  • Install python 3.8.13 with pyenv install 3.8.13
  • Set python version 3.8.13 to be used globally with pyenv global 3.8.13
  • Install virtualenv with python3 -m pip install --user virtualenv
  • Create new virtual env with python3 -m virtualenv .venv
  • Activate new virtual env with source ./.venv/bin/activate
  • Install all project dependencies with pip install -r requirements.txt --use-pep517
  • Check the python version used with which python, which shall be [PROJECT_DIR]/tests/.venv/bin/python.

Windows / Linux

  • Install GitBash
  • Uninstall any previous python version
  • Install python 3.8.13 using the official installation file
  • Install all project dependencies with pip install -r requirements.txt --use-pep517

๐Ÿš€ Project Structure:

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

๐Ÿš€ Test Execution:

  • Fork the repository bdd-gherkin-api-test-automation-framework
  • Clone the repository via HTTPS git clone https://github.com/<your_github_username>/bdd-gherkin-api-test-automation-framework.git or via SSH git clone [email protected]:<your_github_username>/bdd-gherkin-api-test-automation-framework.git
  • Open Pycharm (or any IDE) > File > Open > Open the project where the repository is located (i.e., ../bdd-gherkin-test-automation-framework/tests)
  • Run the command: python -m pytest -v --gherkin-terminal-reporter --reruns 1 --reruns-delay 1 --tags="automated" -s --color="yes" in Terminal

๐Ÿš€ Pycharm Edit Configuration:

  • Go to Edit Configurations...
  • Add New Configuration (+ sign) > Python tests > pytest
  • Provide Target Script path and Working directory (i.e., ../bdd-gherkin-test-automation-framework/tests)
  • Select the required Python interpreter
  • And, Additional Arguments: -v --gherkin-terminal-reporter --reruns 1 --reruns-delay 1 --tags="automated" --color="yes"

gherkin-bdd-api-test-framework's People

Contributors

ashikkumar23 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gherkin-bdd-api-test-framework's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.