Enterprise Selenium 4 E2E testing framework with TestNG, Page Object Model, and Allure reporting. Parallel execution, thread-safe WebDriver management, and CI/CD ready.
| Suite | Tests | Group |
|---|---|---|
| Login | 5 | smoke |
| Inventory | 5 | regression |
| Checkout | 3 | regression |
| Total | 13 |
git clone https://github.com/mustafaautomation/selenium-java-framework.git
cd selenium-java-framework
# Run all tests (headless Chrome)
mvn clean test
# Run smoke tests only
mvn test -Dgroups=smoke
# Run with visible browser
mvn test -Dheadless=false
# Firefox
mvn test -Dbrowser=firefox
# Generate Allure report
mvn allure:serve┌─────────────────────────────────────────┐
│ Test Classes │
│ LoginTest │ InventoryTest │ ... │
├─────────────────────────────────────────┤
│ BaseTest │
│ setUp/tearDown │ loginAsStandardUser() │
├─────────────────────────────────────────┤
│ Page Objects (@FindBy) │
│ LoginPage │ InventoryPage │ CartPage │
│ CheckoutPage │ BasePage │
├─────────────────────────────────────────┤
│ Infrastructure │
│ DriverFactory (ThreadLocal) │
│ TestConfig (System properties) │
├─────────────────────────────────────────┤
│ Selenium 4 │ TestNG │ Allure │ AssertJ │
└─────────────────────────────────────────┘
DriverFactory uses ThreadLocal<WebDriver> for safe parallel execution:
private static final ThreadLocal<WebDriver> DRIVER = new ThreadLocal<>();Each page uses Selenium's PageFactory with @FindBy annotations:
@FindBy(id = "user-name")
private WebElement usernameInput;Common wait/click/type methods in BasePage:
protected void click(WebElement element) {
waitForClickable(element);
element.click();
}TestNG runs test classes in parallel (3 threads):
<suite parallel="classes" thread-count="3">selenium-java-framework/
├── src/main/java/com/quvantic/selenium/
│ ├── config/TestConfig.java # Env-based config
│ ├── utils/DriverFactory.java # ThreadLocal WebDriver
│ └── pages/
│ ├── BasePage.java # Wait/click/type helpers
│ ├── LoginPage.java
│ ├── InventoryPage.java
│ ├── CartPage.java
│ └── CheckoutPage.java
├── src/test/java/com/quvantic/selenium/tests/
│ ├── BaseTest.java # Setup/teardown
│ ├── auth/LoginTest.java # 5 tests
│ ├── inventory/InventoryTest.java # 5 tests
│ └── checkout/CheckoutTest.java # 3 tests
├── src/test/resources/testng.xml # TestNG suite config
├── pom.xml
└── .github/workflows/e2e-tests.yml
| Tool | Purpose |
|---|---|
| Selenium 4.27 | Browser automation |
| TestNG 7.10 | Test runner with parallel + groups |
| WebDriverManager | Automatic driver management |
| Allure 2.29 | Rich HTML reporting |
| AssertJ | Fluent assertions |
| Maven | Build + dependency management |
MIT
Built by Quvantic