TravelTest AI-Assisted Automation Development
Business Scenario
Welcome to the QA Automation Team at TravelTest Pvt. Ltd.
The QA Manager has assigned you the task of using AI-Powered Tools to accelerate Automation Script Development and improve Coding Efficiency within the TravelTest Automation Framework.
In this lab, you will use ChatGPT for Automation Script Generation, GitHub Copilot for Coding Assistance, and AI Techniques for generating Selenium Locators. You will also explore how AI-Assisted Development helps reduce Manual Effort, improve
Pre-Lab Preparation
Ensure ChatGPT access and internet connectivity
Setup Java, Selenium, TestNG, and Maven
Keep TravelTest project ready
Understand basic Selenium scripting
Learn basic AI prompt writing
Configure Eclipse/IntelliJ IDE
Keep test scenarios and test data ready
git pull origin branchNameGit Pull
Script Quality, and speed up Automation Framework Development activities.
Task 1 : Use ChatGPT for Script Generation
Open ChatGPT
1
Launch a web browser.
Open ChatGPT and login to your account.
Identify Automation Scenario
2
Select a test scenario from the TravelTest application.
Example:
Verify user login functionality
Write Prompt for Script Generation
3
Generate Automation Script
4
Enter a proper prompt in ChatGPT.
Example:
Generate Selenium Java script using TestNG for TravelTest login page.
Submit the prompt.
Review the generated Selenium automation code.
Copy Generated Script
5
Copy the generated Java Selenium script from ChatGPT.
Launch Eclipse or IntelliJ IDE.
Open the TravelTest automation framework project.
Open Automation Project
6
Navigate to the tests package.
Create a new Java class.
Example:
Create Test Class
7
LoginTest.javaPaste Generated Script
8
Paste the ChatGPT-generated code into the test class.
Save the file.
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