AI-POWERED QUALITY ENGINEERING
Learn. Automate. Test Smarter.
Practical guides on Generative AI, AI agents, AI tools, Playwright, Selenium, API testing and modern software testing.

Generative AI tools such as ChatGPT, Claude, and Gemini are becoming useful assistants for software testing. But the quality of their responses depends heavily on how we ask questions and provide context.




This is where prompt engineering becomes important. For QA engineers, prompt engineering means giving AI clear instructions, relevant requirements, testing scenarios, and an expected output format to get more useful results.

In this guide: Learn practical prompting techniques for test case generation, API testing, automation code generation, and debugging.

What Is Prompt Engineering?

Prompt engineering is the process of designing and improving instructions given to an AI model to achieve a desired result.

Basic prompt:

Generate test cases for login.

This prompt provides very little context.

Improved prompt:

You are assisting a QA engineer testing a web application's login feature. The username and password are mandatory. Generate positive, negative, boundary, and security-related test scenarios. Present the results in a table with Scenario, Test Data, and Expected Result.

The second prompt provides context, scope, and a clear output format, helping the AI generate more relevant suggestions.

1. Use a Clear Prompt Structure

A useful starting point for QA prompts is:

Role + Context + Requirement + Testing Scope + Expected Output
  • Role: Act as a software QA engineer.
  • Context: An e-commerce application.
  • Requirement: Customers can add products to their cart.
  • Testing scope: Positive, negative, boundary, and edge cases.
  • Expected output: A table containing scenarios and expected results.

You do not need to include every element in every prompt. Add the details that matter to the task.

2. Prompt for Test Case Generation

Suppose you receive a requirement for a subscription feature. Try the following prompt:

Example prompt

Act as an experienced QA engineer. Based on the requirement below, generate functional test scenarios for subscription creation. Include positive, negative, boundary, payment failure, duplicate submission, and error-handling scenarios. Provide the scenario, preconditions, test steps, test data, and expected result in a table.

Requirement: A customer can create a subscription using a valid payment method. The subscription should be created only after successful payment.

Possible scenarios include:

  • Create a subscription with valid customer details.
  • Attempt subscription creation with an invalid payment method.
  • Verify the behavior when payment fails.
  • Retry subscription creation after a failed payment.
  • Attempt to create a duplicate subscription.
  • Verify that a subscription is not created before successful payment.

Review all generated scenarios against the actual business rules before using them.

3. Prompt for API Testing

AI can help identify API testing scenarios before you start implementation.

Example prompt

Act as an API testing specialist. Review the API specification below and suggest scenarios for successful requests, missing fields, invalid data types, invalid authentication, unauthorized access, boundary values, error responses, and duplicate requests. Include expected HTTP status codes only when supported by the specification. Clearly identify assumptions.

Provide the relevant API specification or sanitized request and response examples. AI-generated status codes and expected responses must be verified against the actual API contract.

4. Prompt for Automation Code Generation

If you use Playwright, AI can help create a starting point for an automated test. Try this prompt:

Example prompt

Act as a Playwright test automation engineer using TypeScript. Write a test for the login feature using the requirements below. Use stable locators, meaningful assertions, and appropriate waiting strategies. Avoid fixed timeouts unless necessary. Explain assumptions and identify selectors that need to be verified against the application.

Include the login requirements and example HTML or accessible selectors when available.

Always execute and review the generated code. AI may invent selectors, misunderstand application behavior, or produce code that needs adjustments.

5. Prompt for Debugging Automation Failures

Instead of simply asking AI to fix an error, provide evidence and ask it to investigate the likely causes.

Example prompt

Help me investigate this Playwright test failure. Analyze the error message, relevant test code, and available logs. Identify the most likely causes, explain how to verify each cause, and suggest the smallest appropriate code change. Do not assume the application is defective without evidence.

Include the relevant error message, a sanitized code snippet, and useful logs. This encourages investigation rather than an unsupported code change.

6. Common Prompt Engineering Mistakes

  • Too little context: Important business rules are missing.
  • Vague instructions: The desired testing scope is unclear.
  • No output format: Results are difficult to review or reuse.
  • Unverified assumptions: AI fills gaps with potentially incorrect information.
  • Blindly accepting code: Generated automation may be unreliable.
  • Sharing confidential data: Sensitive credentials, customer information, and proprietary details should not be shared without appropriate authorization.

7. A Simple Way to Improve Your Prompts

  1. Start by asking AI to generate test scenarios.
  2. Add acceptance criteria and business rules.
  3. Specify positive, negative, boundary, and edge cases.
  4. Request a structured output.
  5. Ask AI to identify gaps and assumptions.
  6. Validate the final output against the actual requirements.

This iterative approach is often more useful than trying to write a perfect prompt on the first attempt.

Final Thoughts

Prompt engineering is a practical skill for modern QA engineers. It can help with test design, API testing, automation code generation, debugging, and documentation.

The key is to provide clear context, define the task, specify the expected output, and verify the result.

Better Prompts + QA Expertise + Proper Validation = More Useful AI Assistance

AI can accelerate your testing workflow, but the QA engineer remains responsible for understanding requirements, assessing risk, and deciding what should be tested.

Frequently Asked Questions

What is prompt engineering in software testing?

It is the practice of giving AI clear, contextual instructions to assist with testing activities such as test design, API testing, and automation.

Can prompt engineering improve test case generation?

Clear requirements, testing scope, and output formats can help AI produce more relevant test case suggestions. The results still require QA review.

Can I use AI to generate Playwright tests?

Yes. AI can generate a starting point for Playwright tests, but selectors, assertions, waiting strategies, and test behavior should be verified.

Should I share project requirements with AI tools?

Follow your organization's AI and data-security policies. Remove sensitive information and never share credentials or confidential customer data without explicit authorization.

Related Reading

Disclaimer: This article is for educational purposes. AI tools and their capabilities may change over time. Verify generated technical information and follow your organization's security and privacy policies.
ChatGPT for test case generation for QA engineers

AI is becoming a useful assistant for software testing. One of the simplest ways QA engineers can use AI is to generate and review test cases.

Tools such as ChatGPT can help QA engineers think of positive, negative, boundary, and edge-case scenarios that might otherwise be missed.

However, AI-generated test cases should always be reviewed by a QA engineer before they are used in a real project.

Key idea: AI should assist the QA engineer, not replace QA expertise and business understanding.

What Is AI-Assisted Test Case Generation?

AI-assisted test case generation means using an AI tool to create and review test scenarios based on requirements, user stories, acceptance criteria, API specifications, or existing functionality.

Instead of manually starting with:

"What test cases should I write for this feature?"

You can provide the requirement to ChatGPT and ask it to identify different scenarios.

The process can be:

Requirement → AI-generated scenarios → QA review → Final test cases

1. Generate Test Scenarios From a Requirement

Suppose you have the following requirement:

A customer can create a monthly membership using a valid payment method. The subscription should be created only after successful payment.

You could ask ChatGPT:

Generate positive, negative, boundary, and edge-case test scenarios for this requirement. Include expected results.

The AI might suggest scenarios such as:

  • Create a subscription with valid customer details.
  • Create a subscription with a valid payment method.
  • Attempt subscription creation with an expired card.
  • Attempt subscription creation with an invalid payment method.
  • Cancel the payment during the transaction.
  • Retry after a failed payment.
  • Attempt to create a duplicate subscription.
  • Verify that the subscription is created only after successful payment.

This gives the QA engineer a starting point for test design.

2. Generate Positive and Negative Test Cases

A common mistake when creating test cases is focusing mainly on the happy path. ChatGPT can help expand the scenarios.

You can ask:

Generate positive and negative test cases for a login page. Include validation, security, and boundary scenarios.

Positive scenarios

  • Valid username and password.
  • Valid credentials with different supported browsers.

Negative scenarios

  • Invalid username.
  • Invalid password.
  • Empty username.
  • Empty password.
  • Both fields empty.
  • Account locked after multiple failed attempts.

This can help improve test coverage during the initial test-design phase.

3. Find Boundary and Edge Cases

Boundary conditions are often important in software testing.

Suppose a field allows a maximum of 50 characters. You can ask ChatGPT:

Identify boundary and edge cases for a field that accepts a maximum of 50 characters.

You might get scenarios such as:

  • 0 characters
  • 1 character
  • 49 characters
  • 50 characters
  • 51 characters
  • Special characters
  • Spaces
  • Unicode characters

The QA engineer can then decide which scenarios are actually applicable to the application.

4. Convert Requirements Into a Test Case Table

You can also ask ChatGPT to structure scenarios into a test case format.

For example:

Convert this requirement into test cases with Test Case ID, Scenario, Steps, Test Data, and Expected Result.

A simple output could look like:

ID Scenario Expected Result
TC01 Login with valid credentials User successfully logs in
TC02 Login with invalid password Appropriate error is displayed
TC03 Login with empty password Validation message is displayed
TC04 Login with locked account Login is prevented

5. Improve Existing Test Cases

ChatGPT doesn't have to create test cases from scratch.

You can provide existing test cases and ask:

Review these test cases and identify missing scenarios, duplicate cases, unclear steps, and opportunities to improve coverage.

AI may help identify:

  • Missing negative scenarios
  • Missing boundary cases
  • Duplicate test cases
  • Unclear expected results
  • Missing validation
  • Missing error scenarios

The QA engineer should then decide which suggestions are relevant.

A Better Prompt for QA Engineers

The quality of the AI output depends heavily on the information provided.

Instead of asking:

"Create test cases for login."

Provide more context:

Create functional test cases for a login page. The username is mandatory, the password must contain at least 8 characters, and the account is locked after 5 consecutive failed attempts. Include positive, negative, boundary, and security-related scenarios.

The second prompt gives the AI much more useful information.

A Simple Prompt Structure

A useful structure for QA prompts is:

Context + Requirement + Testing Scope + Expected Output

For example:

You are helping a QA engineer test an e-commerce application. Generate test scenarios for the checkout feature. Include positive, negative, boundary, payment failure, and validation scenarios. Present the results in a table with Scenario, Test Data, and Expected Result.

Don't Trust AI-Generated Test Cases Blindly

This is one of the most important points.

ChatGPT can generate useful scenarios, but it does not automatically understand your complete business context.

It may:

  • Make incorrect assumptions.
  • Miss important business rules.
  • Generate duplicate scenarios.
  • Suggest scenarios that aren't applicable.
  • Miss project-specific integrations.
  • Produce technically incorrect expectations.

Therefore, the QA engineer should always review the generated test cases.

Remember: Treat AI as a test-design assistant, not the final decision-maker.

Best Practices

When using ChatGPT for test case generation:

  1. Provide enough business context.
  2. Include acceptance criteria whenever possible.
  3. Ask for positive and negative scenarios.
  4. Ask specifically for boundary and edge cases.
  5. Review the generated test cases manually.
  6. Remove duplicate or irrelevant scenarios.
  7. Never share confidential or sensitive project information unnecessarily.
  8. Validate the final test cases against the actual application behavior.

Final Thoughts

ChatGPT can reduce the effort required to create and review test cases. It can help QA engineers explore different scenarios, identify potential gaps, and improve test coverage.

However, the most effective approach is not AI instead of QA.

QA Expertise + AI Assistance = Better Test Design

The QA engineer still owns the testing strategy, business understanding, risk assessment, and final decision about what should be tested.


Frequently Asked Questions

Can ChatGPT generate complete test cases?

Yes. ChatGPT can generate test scenarios and test cases from requirements, but QA engineers should review and validate them before using them.

Can ChatGPT replace a QA engineer?

No. AI can assist with test design and documentation, but understanding business risk, requirements, application behavior, and testing strategy still requires human expertise.

What information should I provide to ChatGPT?

Provide relevant requirements, acceptance criteria, business rules, validation rules, supported platforms, and the type of testing required. Avoid sharing confidential or sensitive project information.

Can ChatGPT help find missing test scenarios?

Yes. You can provide your existing test cases and ask ChatGPT to identify potential gaps, duplicate scenarios, boundary cases, and additional negative scenarios.

Related Reading

Disclaimer: This article is provided for educational and informational purposes. AI tools and their capabilities may change over time. Always verify important technical information and follow your organization's security, privacy, and AI usage policies.


Generative AI for software testing — practical guide for QA engineers


Software testing is changing rapidly. Generative AI is becoming an increasingly useful assistant for QA engineers, test automation engineers, SDETs, and developers who work with software quality.

AI tools can help generate test cases, create automation code, analyze failures, generate test data, assist with API testing, summarize defects, and reduce repetitive work.

But AI is not a replacement for a QA engineer. The real value comes from combining human testing expertise with AI capabilities.

In this guide, we will explore practical ways QA engineers can use Generative AI in their daily testing activities.

What Is Generative AI?

Generative AI is a type of artificial intelligence that can create new content based on instructions provided by a user.

Depending on the AI system, it can generate:

  • Text
  • Code
  • Test cases
  • Test scenarios
  • Test data
  • Documentation
  • SQL queries
  • API requests
  • Automation scripts

Popular AI tools such as ChatGPT, Claude, Gemini, GitHub Copilot and other AI coding assistants can be useful in software testing workflows.

Why Should QA Engineers Use Generative AI?

QA engineers spend a significant amount of time performing repetitive activities such as creating test cases, writing automation scripts, analyzing failures, preparing test data, reviewing logs and documenting defects.

Generative AI can help accelerate many of these activities.

The objective should not be to blindly accept AI-generated output. Instead, QA engineers should use AI as a testing assistant.

A simple way to think about it is:

QA Engineer + AI Assistant = Faster and More Effective Quality Engineering

1. Generate Test Cases Using AI

One of the easiest ways to start using Generative AI is test case generation.

Instead of manually creating every possible scenario, you can provide the AI with the requirement, user story or acceptance criteria and ask it to generate test scenarios.

Example

Suppose you have the following requirement:

A registered user should be able to reset their password using their registered email address.

You can ask an AI assistant:

Generate positive, negative and edge test scenarios for a password reset functionality. Include functional, validation, security and usability scenarios.

The AI may identify scenarios such as:

  • Valid registered email address
  • Unregistered email address
  • Invalid email format
  • Empty email field
  • Expired password reset link
  • Already-used reset link
  • Multiple reset requests
  • Weak password
  • Password confirmation mismatch
  • Special characters in password
  • Session timeout
  • Rate limiting

The QA engineer can then review the suggestions and add business-specific scenarios that AI may not know.

2. Generate Positive, Negative and Edge Cases

A common challenge in testing is ensuring that we do not focus only on the happy path.

AI can be particularly useful for brainstorming different categories of scenarios.

For example, you can ask:

For this feature, identify positive cases, negative cases, boundary conditions, edge cases, validation scenarios and security-related test scenarios.

This can help QA engineers think beyond the obvious scenarios.

However, the output should always be reviewed against the actual business requirements.

3. Generate Automation Code

Generative AI can also help QA engineers create automation scripts.

For example, if you use Playwright, you can provide the test scenario and ask AI to create a Playwright test.

A prompt could look like:

Write a Playwright test in TypeScript that opens the login page, enters a valid username and password, clicks Login and verifies that the dashboard is displayed. Use reliable locators and meaningful assertions.

AI can generate an initial implementation that the QA engineer can review and adapt to the project's coding standards.

4. Use AI to Improve Automation Code

AI is not useful only for creating new code. It can also help improve existing automation.

You can provide an existing test and ask AI to:

  • Improve locator strategy
  • Reduce duplicated code
  • Improve readability
  • Add assertions
  • Introduce reusable functions
  • Improve error handling
  • Suggest better waits
  • Identify potential flaky-test problems

For example:

Review this Playwright test and identify potential causes of flakiness. Suggest improvements without changing the business flow.

This can be particularly useful when maintaining large automation suites.

5. Debug Automation Failures Using AI

Automation failures can sometimes take significant time to investigate.

Instead of simply asking AI to "fix the error", provide useful context such as:

  • Error message
  • Stack trace
  • Relevant automation code
  • Expected behaviour
  • Actual behaviour
  • Browser or environment information
  • Relevant logs

For example:

This Playwright test passes locally but fails intermittently in Jenkins. Here is the test code, error message and relevant logs. Analyze possible causes of the flakiness and suggest a structured troubleshooting approach.

This type of prompt gives the AI much more context and generally produces a more useful response than simply providing the error message.

6. AI-Assisted API Testing

Generative AI can also be useful for API testing.

You can provide an API specification or endpoint details and ask AI to suggest:

  • Positive API scenarios
  • Negative scenarios
  • Boundary conditions
  • Invalid request payloads
  • Authentication scenarios
  • Authorization scenarios
  • Status-code validations
  • Schema validation scenarios
  • Data validation scenarios

For example:

Generate API test scenarios for a POST /users endpoint. Include valid requests, missing mandatory fields, invalid data types, duplicate users, unauthorized requests, malformed JSON and boundary conditions.

7. Generate Test Data Using AI

Creating realistic test data can be time-consuming.

AI can help generate examples such as:

  • Customer information
  • Email addresses
  • Product data
  • Addresses
  • JSON payloads
  • CSV test data
  • Boundary values
  • Invalid input combinations

For example:

Generate 20 fictional customer records in JSON format containing customer ID, name, email, country and account status. Do not use real people's personal information.

Always ensure that generated test data complies with your organization's privacy and security requirements.

8. Analyze Defects Using AI

AI can help QA engineers analyze defect information and identify possible areas for investigation.

You can provide:

  • Defect description
  • Expected result
  • Actual result
  • Application logs
  • Error messages
  • Steps to reproduce

Then ask AI to identify possible causes and suggest additional tests.

For example:

Analyze this defect report and identify possible root causes. Also suggest additional test scenarios that could help reproduce or isolate the issue.

Remember that AI-generated root-cause analysis is a hypothesis, not proof. The QA or development team should verify the actual cause.

9. Generate Testing Documentation

Documentation is another area where AI can save time.

AI can help create initial drafts of:

  • Test plans
  • Test scenarios
  • Test case descriptions
  • Release testing summaries
  • Regression test documentation
  • Automation documentation
  • Test strategy drafts
  • Defect summaries

The QA engineer should review and customize the generated content before using it as project documentation.

10. Use AI for Test Review and Coverage Analysis

AI can also act as a second pair of eyes.

You can provide your existing test cases and ask:

Review these test cases against the following acceptance criteria. Identify missing scenarios, duplicate cases, unclear steps and potential edge cases.

This can help identify gaps that might otherwise be missed during manual review.

Popular AI Tools for QA Engineers

There are many AI tools that can assist software testing and development workflows.

  • ChatGPT – useful for test case generation, explanations, debugging, documentation and coding assistance.
  • Claude – useful for analyzing large amounts of context, code review, test design and development assistance.
  • GitHub Copilot – useful for AI-assisted coding and development workflows.
  • AWS Kiro – useful for AI-assisted software development workflows and working with specifications and code.
  • Gemini – useful for coding, analysis and general AI-assisted development tasks.

The best tool depends on the task, organization, security requirements and available integrations.

AI Is Not a Replacement for QA Engineers

This is one of the most important points to understand.

AI can generate test cases and automation code, but it does not automatically understand your complete business context.

A QA engineer still needs to determine:

  • What should actually be tested?
  • What are the business risks?
  • Which scenarios are critical?
  • Is the generated test correct?
  • Does the automation follow project standards?
  • Are the assertions meaningful?
  • Are there security or privacy concerns?

AI should therefore be treated as an assistant rather than an authority.

Common Problems When Using AI for Testing

1. Hallucinations

AI systems can sometimes generate information that sounds correct but is inaccurate.

Always verify important technical information and generated code.

2. Missing Business Context

AI may not know your organization's complete business rules, integrations, workflows or production risks.

Providing appropriate context can improve the quality of the output.

3. Incorrect Automation

AI-generated automation code may compile but still be unreliable or poorly designed.

Review locators, waits, assertions, synchronization, test isolation and framework conventions.

4. Security and Privacy

Do not blindly paste confidential source code, credentials, customer information, tokens, production data or other sensitive information into an AI system.

Always follow your organization's AI and data-security policies.

How to Write Better AI Prompts for QA

The quality of the AI response often depends on the quality of the prompt and context.

A useful QA prompt can include:

  1. Role: Tell the AI what perspective to use.
  2. Context: Explain the application or feature.
  3. Requirement: Provide the business requirement.
  4. Task: Clearly describe what you want.
  5. Constraints: Specify framework, language or standards.
  6. Output format: Explain how you want the result structured.

For example:

You are an experienced QA automation engineer. Analyze the following user story and generate positive, negative and edge test scenarios. The application uses REST APIs and a web UI. Present the scenarios in a table with Scenario, Preconditions, Steps, Expected Result and Priority columns.

Best Practices for AI-Assisted Testing

  • Always review AI-generated output.
  • Provide sufficient context.
  • Never blindly trust generated code.
  • Validate business rules independently.
  • Protect confidential information.
  • Use AI to accelerate work rather than eliminate engineering judgment.
  • Keep human validation in the testing process.
  • Verify AI-generated technical information against reliable documentation.

The Future of AI in Software Testing

Generative AI is only one part of the larger change happening in software quality engineering.

AI agents may eventually be able to perform more complex testing workflows such as:

  • Understanding a testing goal
  • Creating a testing plan
  • Generating test cases
  • Executing tests
  • Analyzing failures
  • Collecting additional information
  • Retrying failed actions
  • Generating reports
  • Recommending additional tests

This direction is often described using terms such as AI agents and agentic AI.

QA engineers who learn how to work effectively with these technologies can become an important part of the next generation of Quality Engineering.

Frequently Asked Questions

Can AI generate complete test cases?

Yes. AI can generate initial test scenarios and test cases from requirements, but QA engineers should review them for correctness, business relevance and coverage.

Can AI write Playwright automation?

Yes. AI coding assistants can generate Playwright code from natural-language requirements. The generated code should be reviewed and adapted to your project's framework and coding standards.

Can AI replace QA engineers?

AI can automate and accelerate many QA activities, but human expertise is still important for business understanding, risk analysis, exploratory testing, validation and quality decisions.

Is AI useful for API testing?

Yes. AI can help generate API test scenarios, request payloads, negative cases, validation scenarios and automation code.

What is the best AI tool for QA engineers?

There is no single best tool for every QA workflow. Tools such as ChatGPT, Claude, Gemini, GitHub Copilot and AWS Kiro can be useful for different tasks. The right choice depends on your requirements, organization, security policies and workflow.

Conclusion

Generative AI can become a powerful assistant for modern QA engineers.

From generating test cases and test data to writing automation code, debugging failures, analyzing defects and preparing documentation, AI can reduce repetitive work and help QA professionals focus more on testing strategy and quality.

The key is to use AI responsibly.

Don't simply ask AI to do the testing. Learn how to work with AI as a Quality Engineering assistant.

At QA With AI Hub, we will continue exploring practical ways to combine AI, automation and software testing.

Learn AI. Improve Testing. Build Better Quality Engineering.


Disclaimer

This article is provided for educational and informational purposes. AI tools and their capabilities may change over time. Always verify important technical information against the relevant official documentation and follow your organization's security, privacy and AI usage policies.