FrameWork Design
----------------
src/
├── main/
│ └── java/
│ └── com/mycompany/automation/
│ ├── drivers/ → WebDriver factory/config
│ ├── pages/ → Page Object classes
│ ├── utils/ → Utility/helper classes
│ └── config/ → Configuration (properties files, etc)
└── test/
├── java/
│ └── com/mycompany/automation/
│ ├── stepdefinitions/ → Cucumber Step Definition classes
│ ├── runners/ → Test runner classes
│ └── hooks/ → Setup/teardown hooks for tests
└── resources/
├── features/ → .feature files (Cucumber)
└── testdata/ → test data (CSV/JSON/YAML) etc.
3.1 Configuration / Driver Initialization
A DriverFactory (in drivers/) which reads configuration (browser name,
remote/local, grid/parallel) and returns WebDriver instance
[Link] (or YAML) for URL and Credentials (baseURL, browser type, etc).
3.2 Page Object Model (POM)
For each page of your application under test, create a Page class in pages/.
Example: LoginPage, HomePage
3.3 Step Definitions & Feature Files
Feature files (.feature) under resources/features written in Gherkin:
Feature: Login functionality
Scenario: Login with valid credentials
Given I am on the login page
When I enter user "username" and password "password"
Then I should see the home page
``` :contentReference[oaicite:5]{index=5}
Corresponding StepDefinition class in stepdefinitions/ where each Gherkin step is
mapped via annotations @Given, @When, @Then.
LambdaTest
Use hooks in hooks/ (with @Before, @After) for setup/teardown (e.g., launch
browser, capture screenshot on failure).
BrowserStack
+1
3.4 Test Runner
In runners/, a class annotated with JUnit (e.g., @RunWith([Link]) or using
Cucumber + JUnit or JUnit5).
Use @CucumberOptions to specify feature file paths, glue (step definitions), tags,
plugin (reporting) etc.
Example:
@RunWith([Link])
@CucumberOptions(
features = "src/test/resources/features",
glue = "[Link]",
plugin = {"pretty", "html:target/[Link]"},
tags = "@Smoke"
)
public class TestRunner { }
3.5 Utilities & Helpers
Utility classes: e.g., WaitUtils, ScreenshotUtil, ExcelUtil/CSVUtil for test data,
LoggerUtil.
Maybe a PageInitializer if you want to instantiate page objects dynamically.
Test data management: parameterize via Scenario Outline + Examples in feature files
OR external data sources.
3.6 Reporting & Logging
Use built-in Cucumber reporting, or integrate with ExtentReports / Allure.
Logging: Use log4j or slf4j for logging steps, errors etc.
Screenshots: On test failures, capture screenshot and attach to report (via After
hook).
3.7 Parallel Execution & Browser Management
To support multiple browsers, you can have a config for browser=chrome/firefox etc.
For parallel execution (if needed), ensure WebDriver instances are thread-safe (use
ThreadLocal).
Configure test runner (or build tool) to allow parallel strategy execution.
4.1 DriverFactory
package [Link];
import [Link];
import [Link];
import [Link];
public class DriverFactory {
private static ThreadLocal<WebDriver> driver = new ThreadLocal<>();
public static WebDriver getDriver() {
return [Link]();
}
public static void initDriver(String browser) {
WebDriver webDriver = null;
if([Link]("chrome")) {
[Link]("[Link]", "path/to/chromedriver");
webDriver = new ChromeDriver();
} else if([Link]("firefox")) {
[Link]("[Link]", "path/to/geckodriver");
webDriver = new FirefoxDriver();
}
[Link]().window().maximize();
[Link](webDriver);
}
public static void quitDriver() {
getDriver().quit();
[Link]();
}
}
4.2 Hooks
---------
package [Link];
import [Link];
import [Link];
import [Link];
public class Hooks {
@Before
public void setUp() {
String browser = [Link]("browser", "chrome");
[Link](browser);
[Link]().get("[Link]
}
@After
public void tearDown() {
[Link]();
}
}
4.3 Page Object – LoginPage
---------------------------
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class LoginPage {
WebDriver driver;
@FindBy(id = "username")
private WebElement userNameField;
@FindBy(id = "password")
private WebElement passwordField;
@FindBy(id = "loginBtn")
private WebElement loginButton;
public LoginPage() {
[Link] = [Link]();
[Link](driver, this);
}
public void login(String user, String pwd) {
[Link](user);
[Link](pwd);
[Link]();
}
}
4.4 Step Definitions – LoginSteps
----------------------------------
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class LoginSteps {
private LoginPage loginPage = new LoginPage();
@Given("I am on the login page")
public void i_am_on_login_page() {
// driver is already navigated in hook
}
@When("I enter user {string} and password {string}")
public void i_enter_user_and_password(String user, String pwd) {
[Link](user, pwd);
}
@Then("I should see the home page")
public void i_should_see_home_page() {
// add assertion code, e.g., verify some element on home page
}
}
6. Sample [Link] Dependencies (Maven)
--------------------------------------
<dependencies>
<!-- Selenium WebDriver -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>selenium-java</artifactId>
<version>4.x.x</version>
</dependency>
<!-- Cucumber Java -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.x.x</version>
</dependency>
<!-- Cucumber JUnit -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.x.x</version>
<scope>test</scope>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- Or if JUnit5: use junit-jupiter -->
</dependencies>
7. Execution & CI/CD Integration
Configure Maven Surefire (or Gradle test task) to run the Cucumber runner.
In your CI pipeline (Jenkins, GitLab CI, GitHub Actions), set system property -
Dbrowser=chrome or other configs to switch browser types.
Generate reports (HTML/JSON) and publish them in CI for visibility.
Possibly integrate with a Selenium Grid or cloud platform (if you need cross-
browser/parallel execution).
8. Customising for Your Context (India / Tamil Nadu / Gobichettipalayam)
Since you’re in Tamil Nadu, you might have slower network or specific environments;
so consider longer default timeouts in WebDriver.
For local/dev environment: use headless mode if machines are lightweight.
Configure logging to generate local HTML reports so testers in your location can
review easily.
If multiple testers/developers, enforce code review of feature files (so business-
readable) and step definitions.
-----------------------------------------------------------------------------------
--------------------------Sample framework
----------------
<project xmlns="[Link]
xmlns:xsi="[Link]
xsi:schemaLocation="[Link]
[Link]
<modelVersion>4.0.0</modelVersion>
<groupId>[Link]</groupId>
<artifactId>web-automation-framework</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<[Link]>11</[Link]>
<[Link]>11</[Link]>
<[Link]>7.11.0</[Link]>
<[Link]>4.8.0</[Link]>
<[Link]>4.13.2</[Link]>
</properties>
<dependencies>
<!-- Selenium WebDriver -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>selenium-java</artifactId>
<version>${[Link]}</version>
</dependency>
<!-- Cucumber Java -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>cucumber-java</artifactId>
<version>${[Link]}</version>
</dependency>
<!-- Cucumber JUnit -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${[Link]}</version>
<scope>test</scope>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${[Link]}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>[Link]</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*[Link]</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>