Skip to main content
@BagmarAnand
Unlocking the Power
of
ChatGPT and AI in Testing
A Real-World Look
Anand Bagmar
Software Quality Evangelist
ABOUT ME
BagmarAnand
linkedin.com/in/anandbagmar/
Hype in AI
Gartner’s Hype Cycle
for AI, 2021 report
https://www.gartner.com/en/articles/the-4-trends-that-prevail-
on-the-gartner-hype-cycle-for-ai-2021
https://www.gartner.com/en/articles/the-4-trends-that-prevail-on-the-gartner-hype-cycle-for-ai-2021
AGENDA
• What is ChatGPT?
• Using ChatGPT in Testing
• Using ChatGPT in Programming
• Limitations of ChatGPT
• Other AI Tools you can use
• Pitfalls of AI
• Summary
• Q&A
@BagmarAnand
ChatGPT
https://openai.com/blog/chatgpt/
@BagmarAnand
ChatGPT – in its own words
@BagmarAnand
ChatGPT is evolving!
@BagmarAnand
GPT-3
https://en.wikipedia.org/wiki/GPT-3
@BagmarAnand
ChatGPT – Interesting Stats
https://www.demandsage.com/chatgpt-statistics/
• ChatGPT was launched on 30th November 2022.
• The new and improved embedding model of ChatGPT was launched on
15th December 2022.
• ChatGPT has crossed one million users within a week of its launch.
• ChatGPT can only fetch data prior to the year 2021 as its training
stopped in the year 2021.
• Microsoft Azure supports OpenAI and provides them with the
computational power required for running ChatGPT.
ChatGPT in Testing
Example: Testing an eCommerce application – Amazon (USA)
@BagmarAnand
Testing Approach
• Getting started
• Framework
• Design patterns
• Code optimization
• Reporting
• Metrics
• Test scenarios
• Test cases
• Test data
• Risk
• Coverage
• Metrics
Strategy Test Design
Automation
Test
execution
@BagmarAnand
Testing - Strategy
• Getting started
• Framework
• Design patterns
• Code optimization
• Reporting
• Metrics
• Test scenarios
• Test cases
• Test data
• Risk
• Coverage
• Metrics
Strategy Test Design
Automation
Test
execution
@BagmarAnand
Testing - Strategy
Question asked:
Create a test strategy for
testing and automating
Amazon USA
@BagmarAnand
Testing - Strategy
Question asked:
Create a test strategy for
testing and automating
Amazon USA
@BagmarAnand
Testing - Strategy
Question asked:
Create a test strategy for
testing and automating
Amazon USA This is not useful.
Seems like a template
@BagmarAnand
Testing - Strategy
Follow-up question:
Give a concrete
strategy for the above
use case
@BagmarAnand
Testing - Strategy
Follow-up question:
Give a concrete
strategy for the above
use case
@BagmarAnand
Testing - Strategy
Follow-up question:
Give a concrete
strategy for the above
use case
@BagmarAnand
Testing - Strategy
Follow-up question:
Give a concrete
strategy for the above
use case
@BagmarAnand
Testing - Strategy
Follow-up question:
Give a concrete
strategy for the above
use case This is promising.
A great start!
@BagmarAnand
Testing – Strategy with Risk Mitigation
Next question:
What risks and their
mitigation strategies
should be included in
the above strategy?
@BagmarAnand
Testing – Strategy with Risk Mitigation
Next question:
What risks and their
mitigation strategies
should be included in
the above strategy?
@BagmarAnand
Testing – Strategy with Risk Mitigation
Next question:
What risks and their
mitigation strategies
should be included in
the above strategy?
@BagmarAnand
Testing – Test Design
• Getting started
• The 1st Test
• Design
patterns
• Reporting
• Metrics
• Test scenarios
• Test cases
• Test data
• Risk
• Coverage
• Metrics
Strategy Test Design
Automation
Test
execution
@BagmarAnand
Test Design – Test Scenarios
Next question:
What are the most
critical test scenarios I
should test for this
website?
@BagmarAnand
Test Design – Test Scenarios
Next question:
What are the most
critical test scenarios I
should test for this
website?
@BagmarAnand
Test Design – Test Scenarios
Next question:
What are the most
critical test scenarios I
should test for this
website?
Great set of regression
scenarios!
@BagmarAnand
Test Design – Test Cases
Next question:
List 10 test cases for
"Product Search and
Filtering" scenario in
order of priority
@BagmarAnand
Test Design – Test Cases
Next question:
List 10 test cases for
"Product Search and
Filtering" scenario in
order of priority
@BagmarAnand
Test Design – Test Cases
Next question:
List 10 test cases for
"Product Search and
Filtering" scenario in
order of priority
Isn’t this amazing?
@BagmarAnand
Test Design – Test Data
Next question:
What test data do I
need to be available
for performing the
above test cases?
@BagmarAnand
Test Design – Test Data
Next question:
What test data do I
need to be available
for performing the
above test cases?
@BagmarAnand
Test Design – Test Data
Next question:
What test data do I
need to be available
for performing the
above test cases?
Well – I was hoping for more
specific, but it’s a start!
@BagmarAnand
Testing - Automation
• Getting started
• The 1st
Test
• Design patterns
• Reporting
• Metrics
• Test scenarios
• Test cases
• Test data
• Risk
• Coverage
• Metrics
Strategy Test Design
Automation
Test
execution
@BagmarAnand
Automation – Strategy
Next question:
What is a good way to
automate the above
test cases?
@BagmarAnand
Automation – Strategy
Next question:
What is a good way to
automate the above
test cases?
@BagmarAnand
Automation – Getting Started
Next question:
I don't know Selenium.
How should I learn?
@BagmarAnand
Automation – Getting Started
Next question:
I don't know Selenium.
How should I learn?
@BagmarAnand
Automation – Getting Started
Next question:
I don't know Selenium.
How should I learn? This answer took some time
TestAutomationUniversity
(TAU) was missed!
@BagmarAnand
Automation – The 1st Test
Next question:
Implement the 1st test
case using Selenium
Java with Junit
@BagmarAnand
Automation – The 1st Test
Next question:
Implement the 1st test
case using Selenium
Java with Junit
@BagmarAnand
Automation – The 1st Test
Next question:
Implement the 1st test
case using Selenium
Java with Junit
@BagmarAnand
Automation – The 1st Test
Next question:
Implement the 1st test
case using Selenium
Java with Junit
@BagmarAnand
Automation – With WebDriverManager
Next question:
Use
WebDriverManager in
the above example
@BagmarAnand
Automation – With WebDriverManager
Next question:
Use
WebDriverManager in
the above example
@BagmarAnand
Automation – With WebDriverManager
Next question:
Use
WebDriverManager in
the above example
@BagmarAnand
Automation – With WebDriverManager
Next question:
Use
WebDriverManager in
the above example
@BagmarAnand
Automation – With WebDriverManager
Next question:
Use
WebDriverManager in
the above example
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Automation – Design Patterns
Next question:
Implement the above
test using Page-
Object-Model design
pattern
@BagmarAnand
Testing – Test Execution
• Getting started
• The 1st Test
• Design
patterns
• Reporting
• Metrics
• Test scenarios
• Test cases
• Test data
• Risk
• Coverage
• Metrics
Strategy Test Design
Automation
Test
execution
@BagmarAnand
Test Execution – Reports
Next question:
How to generate
reports and metrics for
automated tests?
@BagmarAnand
Test Execution – Reports
Next question:
How to generate
reports and metrics for
automated tests?
@BagmarAnand
Test Execution – Reports
Next question:
How to generate
reports and metrics for
automated tests?
@BagmarAnand
Test Execution – Reports
Next question:
How to generate
reports and metrics for
automated tests?
This is not what I was looking for!
@BagmarAnand
Test Execution – Reports
Follow-up question:
Show an example to
generate JunitReports
for the automated
tests
@BagmarAnand
Test Execution – Reports
Follow-up question:
Show an example to
generate JunitReports
for the automated
tests
@BagmarAnand
Test Execution – Reports
Follow-up question:
Show an example to
generate JunitReports
for the automated
tests
ChatGPT in Programming
@BagmarAnand
ChatGPT in Programming
Writing
code
Refactoring
Debugging
...
@BagmarAnand
Writing code
Writing
code
Refactoring
Debugging
...
@BagmarAnand
Writing code
Question asked:
Implement code for count-
and-say
https://leetcode.com/problems/count-and-say/
@BagmarAnand
Writing code
Question asked:
Implement code for count-
and-say
https://leetcode.com/problems/count-and-say/
@BagmarAnand
Writing code
Question asked:
Implement code for count-
and-say
https://leetcode.com/problems/count-and-say/
@BagmarAnand
Writing code
Question asked:
Implement code for count-
and-say
https://leetcode.com/problems/count-and-say/
@BagmarAnand
Writing code
Follow-up asked:
Give above solution in Java
@BagmarAnand
Writing code
Follow-up asked:
Give above solution in Java
@BagmarAnand
Writing code
Follow-up asked:
Give above solution in Java
This actually works J
@BagmarAnand
Writing code
Follow-up asked:
Use proper variable names
for above code
@BagmarAnand
Writing code
Follow-up asked:
Use proper variable names
for above code
@BagmarAnand
Writing code
Follow-up asked:
Use proper variable names
in the loops
@BagmarAnand
Writing code
Follow-up asked:
Use proper variable names
in the loops
@BagmarAnand
Refactoring
Writing code Refactoring
Debugging
...
@BagmarAnand
Refactor code
Question asked:
Given a link to code in
Github, refactor it
@BagmarAnand
Refactor code
Question asked:
Given a link to code in
Github, refactor it
@BagmarAnand
Refactor code
Question asked:
Given a link to code in
Github, refactor it
I have not verified the
validity of this refactoring
@BagmarAnand
Question asked:
Given a snippet of
code, refactor it
Refactor code
@BagmarAnand
Refactor code
Question asked:
Given a snippet of
code, refactor it
@BagmarAnand
Refactor code
Question asked:
Given a snippet of
code, refactor it
@BagmarAnand
Refactor code
Question asked:
Given a snippet of
code, refactor it
@BagmarAnand
Refactor code
Question asked:
Given a snippet of
code, refactor it
Large output pauses abruptly
”continue” proceeds
@BagmarAnand
Refactor code
Question asked:
Given a snippet of
code, refactor it
@BagmarAnand
Complex code
Question asked:
Given a complex code,
asked ChatGPT to
refactor the code, and
then reduce the
complexity
@BagmarAnand
Complex code
Question asked:
Given a complex code,
asked ChatGPT to
refactor the code, and
then reduce the
complexity
@BagmarAnand
Complex code
Question asked:
Given a complex code,
asked ChatGPT to
refactor the code, and
then reduce the
complexity
@BagmarAnand
Complex code
Follow-up question:
Reduce complexity of
above code
@BagmarAnand
Complex code
Follow-up question:
Reduce complexity of
above code
@BagmarAnand
Debugging
Writing
code
Refactoring
Debugging
...
@BagmarAnand
Debugging
Question asked:
Given a buggy code, fix it
@BagmarAnand
Debugging
Question asked:
Given a buggy code, fix it
@BagmarAnand
Debugging
Question asked:
Given a buggy code, fix it
@BagmarAnand
Debugging
Question asked:
Given a buggy code, fix it
Not only fixed the code, ChatGPT
also explained the error
Limitations of ChatGPT
@BagmarAnand
Limitations of ChatGPT
https://openai.com/blog/chatgpt/