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.
- 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.
- 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.
git clone https://github.com/Only1JohnN/API-automation-scripts.git
cd API-automation-scripts
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
-
On Windows:
venv\Scripts\activate
-
On macOS/Linux:
source venv/bin/activate
Install the required Python packages listed in requirements.txt
:
pip install -r requirements.txt
- Test Scripts: Update test scripts in the
tests
folder to configure endpoints, request parameters, and expected responses. Modifyapi_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.
Execute Python tests using pytest
:
pytest tests/api_tests.py
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.
Here are some images illustrating the API functionalities:
-
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.
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
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
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.
This project is licensed under the MIT License. For usage or redistribution, please contact me for permission.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch-name
). - Make your changes and commit (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-branch-name
). - Open a pull request.
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!