- This repository contains a modular and scalable API automation framework built using Python, Pytest, and Requests library.
- It supports parallel execution, data-driven testing, and generates detailed reports using Allure and pytest-html.
β conftest.py - contains pytest fixtures and hook implementation, to generate log files for each tests, kind of listeners that will tell when each test is starting and ending, to get data for api tests such as base url, api key, endpoints etc, hooks (used in report generation/config)
β pytest.ini - pytest configurations and default options
β requirements.txt - project dependencies
β runtest.ps1 - powershell script to run tests easily
ββββallure-report - generated Allure HTML report
ββββallure-results - allure raw result files
ββββdata - test data (JSON, CSV, Excel)
β β create_user.json β β credentials.csv β β stocks.csv β β β ββββfake_store_api --> FakeStore API-specific data β create_user.json β sample_file_json_to_upload.json β sample_file_json_to_upload.png β sample_file_to_upload.xlsx β ββββlogs - log files per test
β test_able_to_get_same_user_created_using_post_request.log β test_able_to_update_same_user_and_get_updated_details.log β test_create_user.log β test_get_uploaded_file.log β test_get_with_query_params.log β test_not_able_to_get_non_existed_file.log β test_some_verifications_for_nested_json_response.log β test_upload_file.log β test_user_not_created.log β test_verify_able_to_get_existing_user_details.log β test_verify_user_created_successfully.log β ββββresults β report.html - pytest html test report output
ββββtests - organized tests by API source
β ββββfake_store_api_tests β β β test_fake_store_api.py β β β test_upload_endpoint.py β β β ββββpostman_echo_api_tests β β β test_postman_echos.py β β β ββββreqres_api_tests β β β test_random_apis.py ββββutils - utility and helper modules
β data_generator.py β helpers.py β request_response_logger.py - β Pytest-based test runner
- β
Parallel testing with
pytest-xdist - β Request/response logging
- β Allure and HTML reports
- β CSV, JSON, Excel-driven data tests
- β Multipart file upload
- β Custom utility functions
- β Supports API chaining and dynamic data generation using faker library
- pytest
- pytest-xdist
- requests
- allure-pytest
- pytest-html
- faker
- Each test creates a separate log file under the logs/ directory using a custom logger defined in utils/request_response_logger.py.
- π GET, POST, PUT, DELETE
- π File Uploads (PNG, Excel, JSON)
- π Authenticated requests (Basic, API Keys etc)
- π Status code, and deep response verification
- π API chaining
- β Allure : Provides interactive test results, Captures logs, request/response, attachments
- β Pytest HTML : Generates self-contained, static reports
- This framework uses pytest-xdist to execute tests in parallel:
pytest -n auto - You can also control the number of workers:
pytest -n 4 - You should have python & allure cli installed on your system, if not please install
- Python
- Allure CLI here
- IDE of your choice for ex: Pycharm Or VS Code
- Clone/download the repo on your system, open in IDE or navigate to project root directory
pip install -r requirements.txtpytest -s -v -n 3 --dist=loadfile --html=results/report.html --self-contained-html --alluredir=allure-results --clean-alluredir testsallure generate allure-results -o allure-report --clean# Open Pytest Self Contained HTML Report Start-Process "results\report.html" # Open Allure Report Start-Process "allure" -ArgumentList "open", "allure-report"- This will first clear the
- allure-results: directory that generates with xml and json files for allure report generation post test execution, so that we get fresh version of these file on each run
- results: directory that contains the report.html i.e, self-contained html report generated by pytest-html
- logs: directory containing separate log file for each executed test in parallel mode using pytest-xdist
- Install dependencies as mentioned in step 1
- Run All Tests with Allure, HTML reports options leveraging pytest-xdist option --dist=loadfile to distribute tests based on file for parallel testing as per step 2
- Generate allure report in allure-report directory based on xml/json file generated in allure-results directory as per step 3
- Directly open pytest self-contained html report from results\report.html directory and interactive allure report from allure-report in your system default browser as per step 4
- π§ Email: rohitnegichd@gmail.com
- π Phone: +91-8077683563
- π LinkedIn: linkedin.com/in/halloichbinrohit





