A robust and scalable test automation framework built using Selenium WebDriver, TestNG, and ExtentReports. This framework follows Page Object Model design pattern and provides comprehensive test reporting capabilities with support for cross-browser testing, parallel execution, and detailed HTML reporting.
- Page Object Model (POM): Enhances test maintenance and reduces code duplication
- TestNG Integration: Parallel execution and flexible test configuration
- Extent Reports: Detailed HTML test reports with screenshots
- Data-Driven Testing: Excel-based test data management
- Cross-Browser Testing: Support for Chrome, Firefox, Safari, and Edge
- Remote Execution: Selenium Grid support for distributed testing
- Retry Mechanism: Automatic retry for flaky tests
- Screenshot Capture: Automatic capture on test failure
- Logging: Comprehensive logging with SLF4J and Logback
- Property Management: Externalized configuration
- CI/CD Ready: Jenkins pipeline support
- Java JDK 11 or higher
- Maven 3.6+
- Chrome/Firefox/Edge browser
- IDE (IntelliJ IDEA or Eclipse) with Lombok plugin installed
- Git for version control
- Clone the repository:
git clone https://github.com/lkumarra/Selenium_Framework.git
- Navigate to the project directory:
cd Selenium_Framework - Install dependencies:
mvn clean install
mvn testmvn test -Dgroups=smoke,regressionmvn test -Dbrowser=firefoxmvn test -DconfigFile=custom-config.properties- Follow Page Object Model
- Use meaningful names for test methods
- Keep tests independent
- Use appropriate assertions
- Handle timeouts properly
- Add comments for complex logic
- Update test data in external files
- Use TestNG groups effectively
-
Tests fail with TimeoutException
- Check implicit/explicit wait configurations
- Verify element locators
- Check page load timeouts
-
Unable to start browser
- Verify WebDriver configuration
- Check browser version compatibility
- Update browser drivers
-
Test data issues
- Verify file paths
- Check file permissions
- Validate data format
src/
├── main/
│ ├── java/
│ │ └── com/org/bank/
│ │ ├── constants/ # Constants and enums
│ │ ├── driverfactory/ # WebDriver initialization
│ │ ├── exceptions/ # Custom exceptions
│ │ ├── models/ # Data models/POJOs
│ │ ├── pages/ # Page objects
│ │ └── utils/ # Utility classes
│ └── resources/
│ ├── Configuration.properties
│ ├── jenkins.groovy
│ ├── logback.xml
│ └── reportportal.properties
└── test/
├── java/
│ └── com/org/bank/
│ ├── listeners/ # TestNG listeners
│ └── tests/ # Test classes
└── resources/
├── testData/ # Test data files
└── testng.xml # TestNG configuration
## Configuration
### Browser Configuration
Supported browsers in `Configuration.properties`:
```properties
browser=chrome # Chrome (default)
browser=firefox # Firefox
browser=edge # Microsoft Edge
browser=safari # Safari
Place test data files in src/test/resources/testData/:
- Excel files for data-driven tests
- JSON files for API test data
- Properties files for environment configuration
- Location:
test-output/ExtentReport.html - Features:
- Test execution summary
- Step-by-step execution details
- Screenshots of failures
- Environment details
- Browser and platform information
- Default TestNG reports in
test-output/index.html - Emailable report in
test-output/emailable-report.html
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
Lavendra Kumar Rajput
- Principal Software Development Engineer in Test (SDET)
- GitHub: lkumarra
- LinkedIn: Lavendra Kumar Rajput
- Email: Lavendra.rajputc1@gmail.com
MIT License
Copyright (c) 2025 Lavendra Kumar Rajput
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For support and queries:
- Create an issue
- Contact the author directly
- Check existing documentation