https://github.com/bhushanambilkar/project_01_selenium_python_webautomation_framework
[ OrangeHRM ] A Hybrid Selenium-Pytest Automation Framework with Page Object Model, Logging, Screenshots, and HTML Reports.
https://github.com/bhushanambilkar/project_01_selenium_python_webautomation_framework
automation-testing framework logging orangehrm page-object-model pytest python reporting reports selenium
Last synced: 6 months ago
JSON representation
[ OrangeHRM ] A Hybrid Selenium-Pytest Automation Framework with Page Object Model, Logging, Screenshots, and HTML Reports.
- Host: GitHub
- URL: https://github.com/bhushanambilkar/project_01_selenium_python_webautomation_framework
- Owner: BhushanAmbilkar
- Created: 2025-09-06T07:16:27.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-09-07T14:39:13.000Z (7 months ago)
- Last Synced: 2025-09-07T16:25:40.300Z (7 months ago)
- Topics: automation-testing, framework, logging, orangehrm, page-object-model, pytest, python, reporting, reports, selenium
- Language: HTML
- Homepage: https://opensource-demo.orangehrmlive.com
- Size: 64.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## OrangeHRM Automation Framework (Python + Selenium + Pytest)
This is a **hybrid automation framework** built with **Python, Selenium, and Pytest**.
The framework is designed to test the **OrangeHRM web application**, but it can be extended to any web project.
It follows the **Page Object Model (POM)** design pattern, which makes the code **clean, reusable, and easy to maintain**.
The framework includes:
- Cross-browser support (Chrome, Firefox, Edge)
- Logging system
- Configuration management
- Screenshots on failure
- HTML test reports
- Support for grouping tests (sanity, regression)
## Project Folder Structure
Here is how the project is organized. Each folder and file has a clear responsibility.
📦 OrangeHRM_Automation_Framework
├── 📂 configuration
└── config.ini # Stores environment details like URL, username, password
├── 📂 logs
└── automation.log # Stores logs for each test execution
├── 📂 pageObjects
└── LoginPage.py # Page Object class for login page
└── DashboardPage.py # Example for dashboard page
├── 📂 testCases
└── conftest.py # Pytest fixtures (browser setup, teardown, hooks)
└── test_login.py # Test case that verifies login functionality
└── test_dashboard.py # Example test case for dashboard
├── 📂 utilities
└── readProperties.py # Reads values from config.ini
└── customLogger.py # Provides reusable logging utility
├── 📂 reports
└── pytest_report.html # Stores HTML reports of test execution
├── 📂 screenshots
└── failed_test.png # Stores screenshots of failed test cases
├── requirements.txt # List of required Python packages
├── pytest.ini # Pytest configuration (markers, options)
├── run.bat # Batch file for test execution
## Features Explained
1. **Page Object Model (POM):** Each web page is represented by a Python class with its own locators and methods. This avoids code duplication.
2. **Cross-browser Testing:** You can run tests on different browsers (Chrome, Firefox, Edge) by passing a parameter.
3. **Configuration Management:** Common values like URL and login credentials are stored in `config.ini`. This avoids hardcoding values inside test cases.
4. **Custom Logging:** Every step in the test execution is logged into `logs/automation.log` for easy debugging.
5. **Screenshots on Failure:** If a test fails, the framework automatically captures a screenshot and saves it inside the `screenshots/` folder.
6. **Reports:** After execution, a clean HTML report is generated inside the `reports/` folder showing test results.
7. **Pytest Fixtures:** Fixtures in `conftest.py` handle browser setup and teardown in a reusable way.
8. **Grouping Tests:** You can mark tests as `sanity` or `regression` and run them selectively.
---
## Getting Started
### 1. Prerequisites
- Install **Python 3.11+**
- Install **pip** (Python package manager)
- Install browser drivers (e.g., ChromeDriver, GeckoDriver)
### 2. Install Dependencies
All required packages are listed in `requirements.txt`. Install them with:
```bash
pip install -r requirements.txt
```
### 3. Run Tests
Run all tests with Chrome (default):
```bash
pytest -v -s --html=reports/report.html
```
Run tests in parallel (using pytest-xdist):
```bash
pytest -v -s -n=3 --browser chrome --html=reports/report.html
```
## Reports, Logs & Screenshots
- Logs: Execution logs are saved in `logs/automation.log.` They show steps, failures, and errors.
- Reports: After execution, a test summary is generated in `reports/pytest_report.html.`
- Screenshots: If a test fails, a screenshot is captured automatically and stored in `screenshots/.`
## Future Enhancements
- Integrate with Jenkins CI/CD for automated execution.
- Add Allure Reports for advanced reporting.
- Implement Data Driven Testing using Excel (openpyxl).
## Author
Developed By :- Bhushan Ambilkar
Contact: ambilkarbhushan25@gmail.com
This project is open for learning and contributions. Feel free to fork and enhance it.