Skip to content

Automated test scripts for validating API endpoints, handling request parameters, and validating responses to ensure functionality and performance.

Notifications You must be signed in to change notification settings

Only1JohnN/API-automation-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API-Automation-Scripts

Welcome to the API-Automation-Scripts repository! This project contains automated scripts for validating various API functionalities, including endpoint testing, handling request parameters, and response validation. The repository uses the Page Object Model (POM) for structured and maintainable test automation.

Table of Contents

Features

  • Endpoint Testing: Validate various API endpoints to ensure they are functioning correctly.
  • Request Parameters Handling: Test different request parameters to verify API robustness and flexibility.
  • Response Validation: Confirm that API responses are accurate and meet expected standards.
  • Page Object Model (POM): Utilize POM to structure and maintain test automation scripts for better readability and scalability.
  • Comprehensive Reporting: Generate detailed reports to analyze API performance and identify issues.
  • Customizable Configurations: Easily adjust testing parameters and scenarios to match your API requirements.

Requirements

  • Python: Required for running automated test scripts.
  • pytest: Framework for running Python tests and generating reports.
  • Requests Library: For making HTTP requests in Python tests.

Setup

Clone the Repository

git clone https://github.com/Only1JohnN/API-automation-scripts.git
cd API-automation-scripts

Create a Python Virtual Environment

To avoid conflicts between dependencies, it's recommended to use a virtual environment. Create one using venv with either python or python3:

# Use either python or python3
python -m venv venv
# or
python3 -m venv venv

Activating the Virtual Environment:

  • On Windows:

    venv\Scripts\activate
  • On macOS/Linux:

    source venv/bin/activate

Install Python Dependencies

Install the required Python packages listed in requirements.txt:

pip install -r requirements.txt

Configure Your Tests

  • Test Scripts: Update test scripts in the tests folder to configure endpoints, request parameters, and expected responses. Modify api_tests.py as needed.
  • Page Object Model (POM): Review and update the POM classes defined in the pages folder to reflect the API endpoints and actions relevant to your tests.

Run API Tests

Execute Python tests using pytest:

pytest tests/api_tests.py

Review Reports

Review the test execution logs to assess API functionality and identify issues. Logs are saved in the logs folder, as logging is enabled for detailed analysis of test outcomes.

API Images

Here are some images illustrating the API functionalities:

Tab Bar

Tab Bar

API 1-3

API 1-3

API 4-6

API 4-6

API 7-9

API 7-9

API 10-11

API 10-11

API 12-13

API 12-13

API 14

API 14

Directory Structure

  • pages/: Contains POM classes used for structuring API test automation.

    • page_objects.py: Defines Page Object Model classes for API interactions.
  • tests/: Contains test scripts for API validation.

    • api_tests.py: Python script for validating various API functionalities.
  • results/: Directory where test results are saved.

    • test_results.log: Log file for test results.
  • requirements.txt: Lists Python dependencies required for test scripts.

API Endpoints

These scripts validate different API endpoints:

  • test_get_all_products
  • test_get_all_brands
  • test_post_to_search_product
  • test_delete_verify_login
  • test_post_create_account
  • test_get_user_detail_by_email

Request Parameters

These scripts handle different request parameters:

  • test_post_to_search_product_without_param
  • test_post_verify_login_valid
  • test_post_verify_login_without_email
  • test_put_update_user_account

Response Validation

These scripts validate various API responses:

  • test_post_to_all_products
  • test_put_to_all_brands
  • test_post_verify_login_invalid
  • test_delete_user_account

Each script handles various aspects of API testing such as checking the validity of endpoints, managing different request parameters, and validating the responses.

License

This project is licensed under the MIT License. For usage or redistribution, please contact me for permission.

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch-name).
  3. Make your changes and commit (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch-name).
  5. Open a pull request.

Contact

For any questions, feedback, or collaboration inquiries, please reach out to Adeniyi John.

Thank you for using API-Automation-Scripts. We hope these tools help you ensure the reliability and performance of your APIs!

About

Automated test scripts for validating API endpoints, handling request parameters, and validating responses to ensure functionality and performance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages