5 Powerful ChatGPT prompts for QA

We are in an era where AI is going to be an important player of the software industry. However its too early to say that AI will completely replace QAs in near future. But it is imperative for us to understand that we(QAs) should be familiar with prompt engineering to be more productive in our work. For that reason, I started exploring ChatGPT’s various capabilities using different prompts for QA work to assist in my day to day responsibilities.

While I don’t heavily depend on its suggestions, I find it particularly handy for certain tasks. It proved to be a quick and helped me finishing a few things at much faster pace.

In this blog, I will be sharing some of my favourite ChatGPT prompts for QA, which I have saved in my notebook for regular use.

ChatGPT Prompts for QA

I believe ChatGPT can’t be much helpful for QAs as software testing needs holistic context and detailed understanding of the software application. ChatGPT may not be able to grasp the full context and intricacies of a specific software application or its interactions.

Relying solely on ChatGPT for generating test scenarios or cases might result in overlooking critical aspects that a human QA professional with domain knowledge would be able to address. ChatGPT can be supporting tool for QAs, assisting in certain aspects or providing insights but human experience remain essential for effective software testing.

Keeping above in mind, I use ChatGPT for certain tasks where detailed knowledge of my software is not necessary. For instance, when a developer makes a code change, such as refactoring a lengthy method into smaller ones, ChatGPT can be leveraged in verifying the modification. Additionally, it can suggest various unit tests to cover these alterations.

Similarly, when testing an address form, ChatGPT can be used for generation of diverse test data with minimal effort.

Here are a few tasks for which I find ChatGPT helpful and I have curated a list of prompts for QA:

  • Test case generation for code change.
  • Test data generation.
  • Code review to discover potential issues.
  • Code generation for test automation.
  • Assisting me in documentation.

#1 – Prompt for QA to generate test cases for application code change

When to use above prompt

Use the above prompt when you need support from ChatGPT to generate thorough test cases for a specific code change. This is beneficial during code reviews to ensure developer has added required tests covering for both positive and negative scenarios. By using this prompt, I am able to uncover a few potential edge cases, which enhances my testing.

When above prompt used for a code change as below:

function calculateDiscount(bin) {
  // Visa range (5111 - 5222)
  const visaPattern = /^5[1-2]\d{2}/;

  // MasterCard range (4111 - 4444)
  const masterCardPattern = /^4[1-4]\d{2}/;

  if (visaPattern.test(bin)) {
    return 15.0; // Visa discount
  } else if (masterCardPattern.test(bin)) {
    return 10.0; // MasterCard discount
  } else {
    return 0.0; // No discount for other card types
Representing ChatGPT prompt for QA response

#2 – Prompt for code Review

When to use above prompt

I use the above prompt when I need support from ChatGPT to suggest improvement in code changed by developer. Using above prompt, I try to understand the code quality and based on the ChatGPT’s response, I see if anything can be improved. Additionally, it helps me uncovering issues like security vulnerabilities.

#3 – Test Data Generation Prompt

When to use above prompt

Above prompt can be used to generate diverse set of test data.

Response from ChatGPT when above prompt was given for email input field.

Test CaseInputDescription
1test@example.comBasic valid email format
2Test@Example.comCase sensitivity check (uppercase)
3tEsT@eXaMpLe.CoMCase sensitivity check (mixed case)
4user123@domain.comAlphanumeric characters
5user.123@domain.comAlphanumeric characters with a dot
6user@123domain.comAlphanumeric characters in the domain
7user@domain.123Alphanumeric characters in the top-level domain
8input@example.comLeading whitespace
9input@example.comTrailing whitespace
10Input123Numeric-only characters
11AlphaStringAlphabetic-only characters
12special@characters!Special characters
13123456Numeric-only input at the minimum allowed length
14AAlphabetic-only input at the minimum allowed length
15verylongemailaddress1234567890@domain.comMaximum allowed length
16Empty input
17test@example.comDuplicate entry
18Powerلُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ冗Naughty string with unicode characters
19<script>alert(‘XSS’)</script>Potential injection attempt (XSS)
20user@exåmple.comLatin characters with international characters
21user@exámple.comUnicode characters with international characters
22user@domain..comDouble dot in the domain
23user@domaincomMissing dot in the domain
24user@domain.cSingle character in the top-level domain
25user@domain.com.Trailing dot in the domain
Table demonstrating ChatGPT response for above prompt

#4 – Code generation for test automation using ChatGPT

Below is a sample ChatGPT prompt for QA that I used to generate a code to give me future date. The purpose of sharing this prompt is to demonstrate its level of detail.

#5 – Prompt for QA to assist in Documentation

Once again, the following ChatGPT prompt for QA serves as an illustrative example of how to write a detailed prompt for maximum assistance from ChatGPT. The specifics of your prompt may vary but it is important to have such level of detail in prompt. Explicitly specify each element of your expectations to enhance the relevance of response.

Read why Selenium with Jmeter is not the best choice for client side performance testing.

To receive such insightful articles directly to your inbox, subscribe our newsletter.

About Author