Content ITV PRO
This is Itvedant Content department
TravelTest Hybrid Automation Framework Design
Business Scenario
Welcome to the QA Automation Team at TravelTest Pvt. Ltd.
The QA Manager has assigned you the task of designing a Hybrid Automation Framework for the TravelTest Web Application Automation Project.
As part of this lab, you will combine the concepts of Data Driven Framework (DDF) and Keyword Driven Framework (KDF) to create a Scalable and Maintainable Automation Framework. You will organize Framework Folders, integrate Reusable Utility Classes and Helper Classes, and manage Test Execution using
Pre-Lab Preparation
Configure Java, Selenium WebDriver, and TestNG properly.
Ensure the TravelTest automation project runs successfully.
Understand the concepts of Data Driven Framework (DDF) and Keyword Driven Framework (KDF).
Review Excel handling using Apache POI libraries.
Verify parameterized scripts and keyword methods are already implemented.
Learn how DDF and KDF can work together in a hybrid framework.
Organize test data files, keywords, and utility classes properly.
Ensure browser drivers and application access are working correctly.
external Test Data and Keywords. You will also improve Automation Efficiency, Reusability, and Framework Structure for handling large-scale TravelTest Automation Scenarios.
Git Pull
git pull origin branchNameTask 1 : Combine DDF and KDF
Open the TravelTest Project
1
Launch Eclipse or IntelliJ IDEA.
Open the TravelTest automation project.
Create Framework Folder Structure
2
Organize the project using separate folders such as:
testdata
keywords
utilities
testcases
drivers
Add Sample Keywords
3
Enter reusable action keywords in the Excel sheet.
Example
| TestCase | Keyword | Object | Value |
|---|---|---|---|
| LoginTest | OpenBrowser | Chrome | |
| LoginTest | Enter Text | Username | admin |
| LoginTest | Enter Text | Password | Passs123 |
| LoginTest | Click | LoginButton | |
| LoginTest | VerifyTitle | Dashboard |
Create a Keyword Class
4
Create a Java class named KeywordActions.
This class will contain reusable Selenium methods.
Example:
public class KeywordActions {
}
Define Browser Action Keyword
5
Create a method for opening the browser.
Example:
public void openBrowser() {
driver = new ChromeDriver();
}
Define EnterText Keyword
6
Define Click Keyword
7
Create a reusable method for entering text.
Example:
public void enterText(By locator, String value)
{
driver.findElement(locator).sendKeys(value);
}
Create a reusable click action method.
Example:
public void click(By locator)
{
driver.findElement(locator).click();
}
Define Validation Keyword
8
Create a method to validate application output.
Example:
public void verifyTitle(String expectedTitle)
{
Assert.assertEquals(driver.getTitle(), expectedTitle);
}
Save and Organize Keywords
9
Store all reusable methods inside the KeywordActions class.
Maintain proper naming conventions for keywords.
Execute Basic Keyword Actions
10
Run the script to verify all keyword methods work successfully.
Ensure actions perform correctly in the browser.
Task 2 : Map Keywords to Methods
Open the TravelTest Project
1
Launch Eclipse or IntelliJ IDEA.
Open the TravelTest automation project.
Prepare Keyword Excel File
2
Open the Keywords.xlsx file.
Ensure keywords are stored properly.
​Example:
| TestCase | Keyword | Object | Value |
|---|---|---|---|
| LoginTest | OpenBrowser | Chrome | |
| LoginTest | Enter Text | Username | admin |
| LoginTest | Click | Login Button |
Create Keyword Action Class
3
Create Keyword Execution Class
4
Create a Java class named KeywordActions.
Add reusable Selenium methods for each keyword.
​Example:
public void click(By locator) {
driver.findElement(locator).click();
}
Create a new class named KeywordEngine.
This class will read keywords from Excel and execute corresponding methods.
Example:
public class KeywordEngine {
}
Read Keywords from Excel
5
Use Apache POI to read keyword values row by row.
Example:
String keyword = sheet.getRow(i).getCell(1).getStringCellValue();
Apply Conditional Mapping
6
Use if-else or switch statements to map keywords to methods.
Example:
if(keyword.equalsIgnoreCase("Click")) {
action.click(locator);
}
OR
switch(keyword) {
case "OpenBrowser":
action.openBrowser();
break;
case "Click":
action.click(locator);
break;
}
Map EnterText Keyword
7
Connect the EnterText keyword with the corresponding Selenium method.
Example:
case "EnterText":
action.enterText(locator, value);
break;
Map Validation Keyword
8
Execute the Keyword Engine
9
Validate Execution
10
Connect validation keywords to assertion methods.
Example:
case "VerifyTitle":
action.verifyTitle(value);
break;
Run the KeywordEngine class.
Verify that keywords are executed sequentially from Excel.
Observe browser actions during execution.
Confirm that each keyword correctly triggers its mapped Selenium method
Task 3 : Execute Tests Using Keywords
Open the TravelTest Project
1
Launch Eclipse or IntelliJ IDEA.
Open the TravelTest automation project.
Prepare Keyword Excel File
2
Open the Keyword Engine Class
3
Open the Keywords.xlsx file.
Verify all test steps and keywords are added properly.
​Example:
| TestCase | Keyword | Object | Value |
|---|---|---|---|
| LoginTest | OpenBrowser | Chrome | |
| LoginTest | Enter Text | Username | admin |
| LoginTest | Enter Text | Password | Passs123 |
| LoginTest | Click | LoginButton | |
| LoginTest | VerifyTitle | Dashboard |
Open the KeywordEngine class.
Ensure it reads keywords from Excel correctly.
Example:
String keyword = sheet.getRow(i).getCell(1).getStringCellValue();
Initialize Keyword Actions
4
Create an object of the KeywordActions class.
Example:
KeywordActions action = new KeywordActions();
Execute Keywords Sequentially
5
Map Keywords to Methods
6
Use loop statements to execute all keywords one by one.
Example:
for(int i=1; i<=rowCount; i++) {
}
Execute methods based on keyword values.
Example:
if(keyword.equalsIgnoreCase("Click")) {
action.click(locator);
}
Execute Browser Actions
7
Run the Keyword Engine
8
Run actions such as:
OpenBrowser
EnterText
Click
VerifyTitle
Observe browser execution during runtime.
Right-click the KeywordEngine class.
Run As → Java Application
OR​
Verify Test Execution
9
Check whether all keywords execute successfully.
Verify application behavior for each test step.
Validate Results
10
Confirm expected outputs are displayed.
Verify assertions and validations pass successfully.
Check Execution Report
11
Open the test-output folder.
Review execution status and results in the TestNG report.
Update Keywords When Required
12
Add new keywords or test steps in Excel.
Re-run the framework without changing the core automation code.
Open the TravelTest Project
1
Launch Eclipse or IntelliJ IDEA.
Open the TravelTest automation project.
Identify Repeated Code
2
Create Reusable Keyword Methods
3
Review existing automation scripts.
Identify repeated Selenium actions such as:
Click
EnterText
OpenBrowser
VerifyTitle
Open the KeywordActions class.
Move common Selenium actions into reusable methods.
Task 4 : Improve Reusability
Example:
public void click(By locator) {
driver.findElement(locator).click();
}
Create Reusable EnterText Method
4
Centralize Browser Initialization
5
Create a common method for text input actions.
Example:
public void enterText(By locator, String value) {
driver.findElement(locator).sendKeys(value);
}
Create a reusable browser setup method.
Example:
public void openBrowser() {
driver = new ChromeDriver();
}
Store Keywords in Excel
6
Open Keywords.xlsx.
Maintain reusable keywords instead of hardcoded test steps.
Example:
| Keyword | Action |
|---|---|
| Click | Click button |
| EnterText | Enter Data |
| VerifyTitle | Validate page |
Reuse Methods Across Test Cases
7
Call the same reusable methods for multiple test scenarios.
Avoid writing duplicate Selenium code.
Create Generic Validation Methods
8
Create reusable assertion methods.
Example:
public void verifyTitle(String expectedTitle) {
Assert.assertEquals(driver.getTitle(), expectedTitle);
}
Execute Multiple Test Cases
9
Call the same reusable methods for multiple test scenarios.
Avoid writing duplicate Selenium code.
Validate Framework Reusability
10
Add new test cases in Excel without modifying automation code.
Confirm the framework handles new scenarios using existing reusable methods.
Maintain Framework Structure
11
Organize:
Organize:
Keywords
Methods
Test data
Utility classes
Ensure the framework remains clean and maintainable.
Good Job!!
You have successfully completed your lab on TravelTest Keyword Driven Framework (KDF), where you learned how to define Reusable Keywords, map them to Selenium Methods, and execute Test Cases using Keyword-Driven Logic.
You also understood how the Keyword Driven Framework improves Reusability, Maintainability, reduces Code Duplication, and simplifies Automation Test Management.
Checkpoint
Git Push
Next-Lab Preparation
git push origin branchNameBy Content ITV