A production-ready automation framework built with Selenium WebDriver 4, Java 11+, TestNG 7.9, and Maven. This framework follows industry best practices and includes comprehensive utilities for advanced automation testing.
β
Page Object Model (POM) - Maintainable and scalable architecture
β
Comprehensive Locators - All 8 Selenium locator types with complete XPath documentation (see BasePage.java)
β
TestNG Framework - Advanced test management with parallel execution
β
Maven Build Tool - Automated dependency and build management
β
WebDriverManager - Automatic browser driver management (no manual downloads)
β
18 Utility Classes - Comprehensive utilities for waits, assertions, file handling, database, API, dropdowns, windows, frames, mouse actions, dynamic locators, screenshots, DataProvider, and POJO support
β
REST API Testing - Complete REST Assured integration with CRUD utilities
β
API Assertions - Comprehensive API validation utilities
β
POJO Models - Pre-built User, Product, and API models with type-safe data handling
β
Database Testing - SQL operations with 5 database support (MySQL, PostgreSQL, SQLite, SQL Server, Oracle)
β
Data-Driven Testing - TestNG @DataProvider with CSV, Excel, database, and custom data sources + POJO support
β
Hard & Soft Assertions - Flexible validation strategies
β
Smart Waits - Implicit, explicit, and fluent wait implementations
β
Screenshot Capture - Automatic on failure + manual capture
β
Parallel Execution - Run tests concurrently (tests/methods/classes)
β
Thread-Safe - Designed for parallel test execution
β
Cross-Browser Support - Chrome, Firefox, and more
π COMPLETE_FRAMEWORK_GUIDE.md - Full guide with detailed examples, all utilities, and best practices
- Java 11+ -
java -version - Maven 3.6+ -
mvn -version - Optionally: IntelliJ IDEA, Eclipse, or VS Code
cd SeleniumJava
mvn clean install# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=GoogleSearchTest
mvn test -Dtest=ApiTests
# Run tests in parallel
mvn test -DsuiteXmlFile=testng-parallel-methods.xml
mvn test -DsuiteXmlFile=testng-parallel-classes.xml
# Run demo tests
mvn test -Dtest=AssertionDemoTest # Hard & soft assertions
mvn test -Dtest=WaitsDemoTest # Different wait strategies
mvn test -Dtest=ScreenshotDemoTest # Screenshot on failure
mvn test -Dtest=DataDrivenDemoTest # Data-driven testing
mvn test -Dtest=POJODemoTest # POJO model usage
mvn test -Dtest=SQLDemoTest # Database testing
# Run all API tests
mvn test -Dtest=*ApiTests*
# Run tests with specific browser
mvn test -DBrowser=FirefoxSeleniumJava/
βββ .github/ # GitHub workflows & CI/CD
βββ docs/ # π Documentation files
βββ src/ # π» Source code
β βββ main/java/com/seleniumjava/
β β βββ base/ # 2 base classes (BaseTest, BaseApiTest)
β β βββ models/ # 6 POJO model classes (User, Product, etc.)
β β βββ pages/ # 3 Page Object Models (BasePage, etc.)
β β βββ utils/ # 18 utility classes (Waits, Assertions, etc.)
β βββ test/
β βββ java/com/seleniumjava/
β β βββ tests/ # 13 test classes
β β βββ listeners/ # TestNG listeners
β βββ resources/ # Test resources & configurations
β βββ config/ # TestNG XML files
β βββ environments/ # Environment properties
β βββ testdata/ # CSV, text test data files
βββ pom.xml # Maven configuration
βββ target/ # Build output (classes, jars, reports)
βββ README.md # Root documentation
// Page Object
public class LoginPage extends BasePage {
private By usernameField = By.id("username");
public void login(String user, String pass) {
type(usernameField, user);
click(loginButton);
}
}
// Test
public class LoginTest extends BaseTest {
@Test
public void testLogin() {
new LoginPage(driver).login("user", "pass");
WaitUtils.waitForUrlContains(driver, "/dashboard", 10);
AssertionUtils.assertTrue(isLoggedIn(), "Login successful");
}
}public class UserApiTests extends BaseApiTest {
@Test
public void testCreateUser() {
ApiUser newUser = new ApiUser("John", "john@test.com");
Response response = apiClient.post("/users", newUser);
ApiAssertionUtils.assertCreated(response);
ApiAssertionUtils.assertJsonFieldExists(response, "id");
}
}- BaseTest.java - UI test foundation with WebDriver setup, teardown, browser management
- BaseApiTest.java - API test foundation with REST client initialization
- BasePage.java - Core page class with 8 Selenium locator strategies and common web interactions
- GoogleSearchPage.java - Example page object for Google Search automation
- AdvancedPage.java - Advanced interactions (frame switching, window handling, dynamic content)
- User.java - User entity (id, name, email, username, phone)
- Product.java - Product entity (id, name, price, category, description)
- ApiUser.java - API-specific user model
- Post.java - Blog post model for API testing
- Comment.java - Comment model for nested JSON testing
- TestData.java - Generic test data wrapper
Waits: WaitUtils.java
Assertions: AssertionUtils.java, ApiAssertionUtils.java
UI Interactions: MouseActionsUtils.java, DropdownUtils.java, FrameSwitchingUtils.java, WindowHandlingUtils.java
File & Data: FileHandlingUtils.java, DataReader.java, DataProviderUtils.java, POJOUtils.java
Configuration: ConfigManager.java, LoggerUtil.java
Database & API: SQLUtils.java, RestApiClient.java
Advanced: DynamicLocatorUtils.java, ScreenshotUtils.java, CommonUtils.java
Basic: GoogleSearchTest.java, SampleTestTemplate.java
Demo: AssertionDemoTest.java, WaitsDemoTest.java, ScreenshotDemoTest.java, DataDrivenDemoTest.java
Advanced: AdvancedTest.java, ComprehensiveFeatureTest.java, POJODemoTest.java, SQLDemoTest.java
API: ApiTests.java, AdvancedApiTests.java, ExampleApiTestWithBase.java
Config: config.properties, testng.xml, testng-parallel-*.xml
Environments: dev.properties, test.properties, staging.properties, prod.properties
Test Data: users.csv, products.csv, test-data.csv, sample.txt
- README.md - Project overview (this file)
- COMPLETE_FRAMEWORK_GUIDE.md - Comprehensive guide with all utilities and examples
- API_TESTING_GUIDE.md - Complete REST API testing guide
- API_QUICK_REFERENCE.md - Quick API reference
- ENVIRONMENT_SETUP.md - Environment setup instructions
- WINDOWS_AGENTS_SETUP.md - Windows CI/CD setup
- Selenium WebDriver 4.15.0
- REST Assured 5.4.0 (API testing)
- TestNG 7.9.0 (parallel execution, listeners, assertions)
- WebDriverManager 5.6.3 (auto browser driver setup)
- Apache Commons (file ops, CSV, configuration)
- Maven 3.6+ (build automation)
π ENVIRONMENT_SETUP.md - Complete setup guide
- JDK 11+ and Maven installation
- IDE setup (IntelliJ, Eclipse, VS Code)
- WebDriverManager configuration
- Running first test
πͺ WINDOWS_AGENTS_SETUP.md - Windows CI/CD setup
- Windows agent configuration
- GitHub Actions and Jenkins integration
π COMPLETE_FRAMEWORK_GUIDE.md - Full detailed guide
- Setup & installation
- All 18 Utility Classes with examples
- BaseTest and BaseApiTest usage
- Page Object Model implementation
- POJO models and data-driven testing
- TestNG advanced features (parallel execution, listeners)
- Troubleshooting and optimization
π API_TESTING_GUIDE.md - REST API testing guide
- REST Assured fundamentals
- RestApiClient usage for CRUD operations
- Authentication methods
- API assertions and validation
- JSON payload handling with POJO models
- Data-driven API testing
β‘ API_QUICK_REFERENCE.md - Quick reference
- Common patterns and code snippets
- Assertion methods and usage
- REST client configuration
π Learning Folder - Java learning repository with 26 programs covering Basic, OOP, Advanced, and Interview Preparation
β
Always extend BaseTest for UI tests - ensures proper WebDriver setup
β
Always extend BaseApiTest for API tests - provides REST client and utilities
β
Use WaitUtils instead of Thread.sleep() - more reliable and faster
β
Use soft assertions for multiple validations - test continues on assertion failure
β
Enable TestListener for auto-screenshots - captures on test failures
β
Use Page Object Model - keeps tests maintainable
β
Use POJO models for test data - type-safe data management
β
Run tests in parallel - faster execution using TestNG
β
Use environment properties - different configs for dev/test/staging/prod
β
Read COMPLETE_FRAMEWORK_GUIDE.md for detailed examples
@Test
public void testSearch() {
GoogleSearchPage page = new GoogleSearchPage(driver);
page.searchFor("Selenium");
WaitUtils.waitForElement(driver, By.xpath("//h3"), 10);
AssertionUtils.assertTrue(page.hasResults(), "Results should display");
}@Test
public void testCreateUser() {
ApiUser user = new ApiUser("John", "john@test.com");
Response response = RestApiClient.post("/users", user);
ApiAssertionUtils.assertStatusCode(response, 201);
}@DataProvider
public Object[][] loginData() {
return new Object[][] { {"user1", "pass1"}, {"user2", "pass2"} };
}
@Test(dataProvider = "loginData")
public void testLogin(String user, String pass) {
// Test code
}Version: 1.0-SNAPSHOT | Status: Production Ready β | Last Updated: February 2026
π Get Started: COMPLETE_FRAMEWORK_GUIDE.md
π API Testing: API_TESTING_GUIDE.md
π Quick Reference: API_QUICK_REFERENCE.md