TravelTest AI Debugging & Framework Optimization
Business Scenario
Welcome to the QA Automation Team at TravelTest Pvt. Ltd.
The QA Manager has assigned you the task of debugging Selenium Failures and optimizing the Automation Framework using AI-Assisted Techniques within the TravelTest Framework.
In this lab, you will use AI-Powered Debugging Methods to identify and fix Selenium Execution Issues, optimize Wait Strategies, improve Framework Performance, and enhance Test Coverage. You will also explore how AI-Assisted Framework Optimization helps reduce Flaky Tests, improve Execution Stability, and increase Automation Efficiency.
Pre-Lab Preparation
Install Java, Selenium WebDriver, Maven, and TestNG.
Configure browser drivers and IDE setup.
Ensure the TravelTest framework is running properly.
Install AI tools like GitHub Copilot or use OpenAI ChatGPT.
Review common Selenium exceptions and TestNG reports.
Execute existing test cases to identify failures before debugging.
git pull origin branchNameGit Pull
Task 1 : Debug Selenium failures using AI
Open Automation Project
1
Launch Eclipse IDE.
Open the TravelTest Selenium project.
Open Test Script
2
Navigate to:
Run Selenium Test
3
Right-click the test file.
Select:
Run As → TestNG Test
OR run using Maven:
mvn test
src/test/javaOpen the required test class file.
Observe Failure
4
Check Console output.
Identify failed test case and Selenium exception.
Example:
Copy the complete error from Console logs.
Example:
Copy Error Message
5
NoSuchElementExceptionUnable to locate element
Open OpenAI ChatGPT or use GitHub Copilot.
Analyze Error Using AI
6
Paste the error message.
Review AI suggestions for fixing the issue.
Update Script if Required
9
Execute the Script
10
Verify Test Execution
11
Modify:
Application URL
Locators
Test data
Browser setup
Run the test case using TestNG.
Run As → TestNG Test
Observe browser execution.
Validate login functionality execution.
Review and Debug Script
12
Check for compilation or execution errors.
Correct issues if required.
Re-run the script successfully.
Task 2:Use GitHub Copilot for Coding Support
Open IDE
1
Launch VS Code, Eclipse, or IntelliJ IDEA.
Open the TravelTest automation project.
Install GitHub Copilot Extension
2
Sign in to GitHub
3
Navigate to Extensions/Plugins section.
Search for:
GitHub Copilot
Install the extension.
Open Test Package
4
Navigate to the automation test package inside the project.
Example:
Login using your GitHub account.
Authorize GitHub Copilot access in IDE.
src/test/java/testsCreate New Test Class
5
Start Writing Selenium Code
6
Create a new Java class.
Example:
SearchFlightTest.javaBegin typing Selenium commands or comments.
Example:
// Write Selenium script for login functionality
Accept GitHub Copilot Suggestions
7
Observe AI-generated code suggestions.
Press:
Tab
Accept the suggested code.
Complete Script Generation
8
Continue typing required methods and validations.
Use Copilot suggestions for:
WebDriver setup
Locators
Test methods
Assertions
Save the Script
9
Save the generated automation script.
Verify code structure and syntax.
Execute the Test Script
10
Run the test case using TestNG.
Run As → TestNG Test
Verify Automation Execution
11
Observe browser actions during execution.
Validate expected application behavior.
Check generated code quality.
Modify or optimize script if required.
Re-run the test successfully.
Review and Improve Code
12
Open the TravelTest Application
1
Launch a browser.
Open the TravelTest web application.
Open Developer Tools
2
Right-click on the required web element.
Select: Inspect
Task 2 :Generate Locators Using AI
Identify Web Element
3
View the HTML source of the selected element.
Example:
Copy the HTML code of the web element.
Copy Element HTML
4
Launch ChatGPT or any AI locator generation tool.
Open ChatGPT or AI Tool
5
Provide the copied HTML and request locator generation.
Example:
Enter Locator Generation Prompt
6
<input type="text" id="username" name="userName">
Generate XPath and CSS Selector for the following HTML element.Review Generated Locators
7
Observe AI-generated locators.
Example:
Copy Generated Locator
8
Select the most stable and readable locator.
Copy the generated XPath or CSS Selector.
Add Locator in Automation Script
9
Open the Selenium test script in IDE.
Add the generated locator.
Example:
XPath: //input[@id='username']
CSS Selector: input#username
driver.findElement(By.xpath("//input[@id='username']")).sendKeys("admin");
Execute the Script
10
Run the automation test using TestNG.
Run As → TestNG Test
Verify Locator Functionality
11
Observe whether the element is identified successfully.
Validate successful interaction with the element.
Optimize Locator if Required
12
Modify locator strategy if element identification fails.
Re-run the script successfully.
Open the Automation Project
1
Launch Eclipse, IntelliJ, or VS Code.
Open the TravelTest automation framework project.
Prepare Reusable Framework Components
2
Verify reusable classes are available:
Base classes
Utility methods
Page Object classes
Common functions
Task 4 : Improve Script Creation Speed
Open AI Tool
3
Launch ChatGPT or enable GitHub Copilot in IDE.
Select Automation Scenario
4
Choose a test scenario for script development.
Example:
Verify flight booking functionality
Enter prompt in ChatGPT or use Copilot suggestions.
Example:
Generate Selenium TestNG script for flight booking process.
Generate Initial Script Using AI
5
Integrate reusable methods instead of writing code manually.
Example:
Reuse Existing Methods
6
loginToApplication();Generate XPath or CSS selectors using AI tools.
Add generated locators into scripts.
Use AI for Locator Generation
7
Use Copilot suggestions for:
WebDriver setup
Assertions
Wait conditions
Test methods
Auto-Generate Repetitive Code
8
Run the automation test using TestNG.
Run As → TestNG Test
Save the Automation Script
9
Execute the Test Script
10
Save generated and optimized test scripts in the project.
Observe reduced manual coding effort.
Verify faster script creation and execution.
Verify Execution Speed
11
Refactor reusable code if required.
Store utilities and methods for future automation tasks.
Optimize and Reuse Scripts
12
Good Job!!
You have successfully completed the lab on TravelTest AI-Assisted Automation Development, where you learned how to use ChatGPT for Script Generation, GitHub Copilot for Coding Support, and AI for generating Selenium Locators.
You also understood how AI-Assisted Development improves Automation Speed, Script Quality, and Development Efficiency within the TravelTest Automation Framework.
Checkpoint
Git Push
git push origin branchNameNext-Lab Preparation