Code Monkey home page Code Monkey logo

gorestapiautomation's Introduction

GorestAPI Automation

The Gorest API Automation project is an api testing framework that ensures the reliability and security of gorest APIs through a range of features. Gorest APIs are freely available APIs with Bearer access token and tons of features. The framework incorporates data-driven testing, positive/negative tests validation, and Pytest parameterizations for efficient test of multiple data. With logging and detailed reporting, it provides insights into test results. The project includes a retry mechanism for handling limited request failures and validates various aspects such as authentication,content-type, response time, pagination parameters, status codes, response structure, and response validation. Custom assertions enhance test coverage, making it a comprehensive framework for thorough API testing.

Run using Docker Container

  • Docker containers makes it easy to run the tests in a specific environment where you do not have to install anything specifically. Just pull the image and run simple command to run the tests.
  • Image to use for this project gorestapi-automation
  • All the instructions are given on docker image overview for running tests in container

Points to know before running the project locally

  • Signup to go rest for the access token https://gorest.co.in/
  • store the access token in conf.ini file in token variable
  • Access token is required for POST, PUT, PATCH and DELETE methods.
  • Created data with a particular access token will only be available for same user and not to the rest.
  • According to gorest we can access the GET request without Bearer token but the data created during tests won't be available to validate, Hence used Bearer token for GET requests also.
  • Data will be removed on daily basis.
  • Do check the website https://gorest.co.in for more details on request-rate-limits pagination parameters status codes curl example for REST API

Run Locally

  • Clone the Project
git clone https://github.com/MubeenAhmadShaikh/GorestAPIAutomation.git
  • Go to the project directory
cd GorestAPIAutomation
  • Install dependencies
pip install -r requirements.txt
  • Create conf.ini file using conf.ini.templates file in root directory and edit the token variable
token = your_access_token_here
  • Navigate to tests directory
cd tests
  • Run all the tests
pytest -s -v

Generating Allure and HTML reports

Pytest Html report

Dependensies pytest-html

  • Run the tests using following command
pytest test_filename.py -s -v -m "marker_name" --html=path_to_save_report/report.html

Generated Pytest HTML report.

Allure interactive report

Dependensies allure-pytest allure commandline

  • Run the tests using following command
pytest test_filename.py -s -v -m "marker_name" --alluredir=path_to_directory_for_saving_json_data
  • Using the JSON data generated for tests generate allure reports with following command
allure serve path_to_directory_of_json_data
  • To save the html to system use following command
allure generate path_to_directory_of_json_data
  • Video of allure interactive reports

Details of arguments

Parameter Option Description
pytest required Pytest command to run the tests from terminal
test_filename.py optional To run the tests from specific file if not provided all the files with 'test_' or '_test' will be considered
-s optional for displaying console logs
-v optional for displaying additional details
-m "marker_name" optional To run the customised markers | Accepted values: [positive, negative]
--html="Path/file_name.html" optional To generate the html report at given path
--alluredir=path_to_directory_for_saving_json_data optional To generate the json data files for allure report at given path
allure serve required To generate the Allure report using json data files at given path

Features

  • GET, POST, PUT, PATCH, DELETE APIs Tested
  • API Test Automation
  • RESTapis Testing
  • Schema Validation
  • Response data Validation
  • Data driven tests
  • End-to-end tests
  • Positive/negative tests
  • Pytest Parameterizations
  • Logging
  • Interactive reporting [ HTML Reporting | Allure Reporting ]
  • Retry mechanisam for limited requests
  • Auth validations using Bearer token
  • status code validation
  • Searching | Pagination validation
  • content-type | environment | response time validations
  • Auth token verification
  • Response body validation
  • Custom assertions

Developed using

  • Python
  • Pytest
  • Requests library
  • Allure reports
  • Docker

๐Ÿ›  Skills

Python Pytest Allure reports Docker HTML reports Automation Testing API Testing RESTapi

gorestapiautomation's People

Contributors

mubeenahmadshaikh avatar

Watchers

 avatar

gorestapiautomation'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.