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)
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
- Page Object Model (POM): Each web page is represented by a Python class with its own locators and methods. This avoids code duplication.
- Cross-browser Testing: You can run tests on different browsers (Chrome, Firefox, Edge) by passing a parameter.
- Configuration Management: Common values like URL and login credentials are stored in
config.ini. This avoids hardcoding values inside test cases. - Custom Logging: Every step in the test execution is logged into
logs/automation.logfor easy debugging. - Screenshots on Failure: If a test fails, the framework automatically captures a screenshot and saves it inside the
screenshots/folder. - Reports: After execution, a clean HTML report is generated inside the
reports/folder showing test results. - Pytest Fixtures: Fixtures in
conftest.pyhandle browser setup and teardown in a reusable way. - Grouping Tests: You can mark tests as
sanityorregressionand run them selectively.
- Install Python 3.11+
- Install pip (Python package manager)
- Install browser drivers (e.g., ChromeDriver, GeckoDriver)
All required packages are listed in requirements.txt. Install them with:
pip install -r requirements.txt
Run all tests with Chrome (default):
pytest -v -s --html=reports/report.htmlRun tests in parallel (using pytest-xdist):
pytest -v -s -n=3 --browser chrome --html=reports/report.html-
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/.
-
Integrate with Jenkins CI/CD for automated execution.
-
Add Allure Reports for advanced reporting.
-
Implement Data Driven Testing using Excel (openpyxl).
Developed By :- Bhushan Ambilkar
Contact: [email protected]
This project is open for learning and contributions. Feel free to fork and enhance it.