A structured Selenium WebDriver automation framework integrated with TestNG — built for cross-browser testing, parallel execution, and comprehensive regression testing.
This project is a complete Selenium WebDriver + TestNG automation framework built in Java. It demonstrates cross-browser testing, parallel test execution, data-driven testing, and CI/CD integration with Jenkins — following industry-standard practices used in professional QA teams.
| Test Type | Description |
|---|---|
| 🌐 Cross-Browser Testing | Chrome, Firefox, Edge support |
| 🔁 Regression Suite | Full regression across all modules |
| 📊 Data-Driven Testing | TestNG DataProvider with Excel/JSON |
| ⚡ Parallel Execution | Multi-thread test execution via TestNG XML |
| 📋 Reporting | ExtentReports for rich HTML reports |
Selenium-TestNGFrameWork/
│
├── src/
│ ├── main/java/
│ │ ├── base/
│ │ │ └── BaseTest.java # WebDriver setup & teardown
│ │ ├── pages/
│ │ │ ├── LoginPage.java
│ │ │ └── DashboardPage.java
│ │ └── utils/
│ │ ├── DriverFactory.java # Browser factory
│ │ ├── ExtentReportManager.java
│ │ └── DataProviderUtils.java
│ │
│ └── test/java/
│ ├── LoginTests.java
│ ├── DashboardTests.java
│ └── RegressionSuite.java
│
├── testng.xml # TestNG suite configuration
├── pom.xml # Maven dependencies
└── README.md
- Automation Tool: Selenium WebDriver
- Language: Java
- Test Framework: TestNG
- Build Tool: Maven
- Design Pattern: Page Object Model (POM)
- Reporting: ExtentReports
- CI/CD: Jenkins
- Browsers: Chrome · Firefox · Edge
- Java JDK 11 or above
- Maven 3.6+
- Chrome / Firefox / Edge browser installed
git clone https://github.com/usmanabbas-qa/Selenium-TestNGFrameWork.git
cd Selenium-TestNGFrameWorkmvn clean installmvn testmvn test -DsuiteXmlFile=testng.xmlmvn test -Dbrowser=firefox
mvn test -Dbrowser=chrome// LoginTests.java — Selenium + TestNG Test
public class LoginTests extends BaseTest {
LoginPage loginPage;
@BeforeMethod
public void setUp() {
loginPage = new LoginPage(driver);
loginPage.navigateTo("https://example.com/login");
}
@Test(description = "Valid user login")
public void testValidLogin() {
loginPage.enterUsername("testuser@example.com");
loginPage.enterPassword("password123");
loginPage.clickLoginButton();
Assert.assertTrue(driver.getCurrentUrl().contains("/dashboard"),
"User should be redirected to dashboard after login");
}
@Test(dataProvider = "invalidCredentials",
description = "Invalid login scenarios")
public void testInvalidLogin(String email, String password) {
loginPage.enterUsername(email);
loginPage.enterPassword(password);
loginPage.clickLoginButton();
Assert.assertTrue(loginPage.isErrorMessageDisplayed(),
"Error message should be shown for invalid credentials");
}
@DataProvider(name = "invalidCredentials")
public Object[][] invalidCredentials() {
return new Object[][] {
{"wrong@email.com", "wrongpass"},
{"", "password123"},
{"user@test.com", ""}
};
}
}This framework is configured to run with Jenkins:
- Create a new Jenkins Pipeline job
- Connect to this GitHub repository
- Set build trigger:
Poll SCMorGitHub Webhooks - Add build step:
mvn clean test - Publish ExtentReports HTML output as build artifact
⭐ If you found this project helpful, please give it a star!