Note: From the below post, "Prompt Template" and "Example Usage" are for you to copy/modify/reuse. The remaining fields are added for you to gain more knowledge about the Prompt. Happy learning!
Purpose
Any Functionality | Generate test cases using provided examples | Test Case Generation | Few-Shot Prompt
QE Category
Test Case Generation
Prompt Type
Few-Shot
Typical SUTs and Quality Phases
Ideal for refining and expanding test cases during iterative test design or user story grooming.
Prompt Template
Role: A QA engineer tasked with generating test cases for [Feature Description] based on the user story below and the provided examples.
Context:
- **User Story**: [Insert User Story]
- **Acceptance Criteria**: [List Criteria]
- **Priority**: High/Medium/LowExamples:
1. **Test Case ID**: TC-001
- **Title**: Validate file upload with correct format.
- **Preconditions**: User is logged into the application.
- **Steps**:
1. Navigate to the file upload page.
2. Select a valid CSV file.
3. Click the 'Upload' button.
- **Expected Results**: File is uploaded successfully, and a confirmation message is displayed.2. **Test Case ID**: TC-002
- **Title**: Reject unsupported file format during upload.
- **Preconditions**: User is logged into the application.
- **Steps**:
1. Navigate to the file upload page.
2. Select an unsupported file format (e.g., .exe file).
3. Click the 'Upload' button.
- **Expected Results**: File is not uploaded, and an error message is displayed.Task:
Generate at least 5 additional test cases, ensuring:
1. They adhere to the format used in the examples.
2. Include test cases for edge conditions and error handling.
Example Usage
Role: A QA engineer tasked with generating test cases for a dynamic pricing feature in a SaaS platform.
Context:
- **User Story**: As a product manager, I want to dynamically adjust pricing based on user location and demand to maximize revenue.
- **Acceptance Criteria**:
- Pricing should adjust within 1 second of location change.
- Discounts must apply correctly based on promotional campaigns.
- Invalid or incomplete location data must default to a base price.
- **Priority**: HighExamples:
1. **Test Case ID**: TC-001
- **Title**: Validate pricing adjustment for a valid location change.
- **Preconditions**: User is on the pricing page.
- **Steps**:
1. Enter a valid location in the 'Location' field.
2. Observe the displayed pricing.
- **Expected Results**: Pricing updates correctly within 1 second based on the new location.2. **Test Case ID**: TC-002
- **Title**: Validate default pricing for incomplete location data.
- **Preconditions**: User is on the pricing page.
- **Steps**:
1. Enter incomplete location data (e.g., country only).
2. Observe the displayed pricing.
- **Expected Results**: Default pricing is displayed.Task:
Generate at least 5 additional test cases, ensuring:
1. They adhere to the format used in the examples.
2. Include test cases for edge conditions and error handling.
Tested in GenAI Tools
Extensively optimized for ChatGPT, Claude, Microsoft Copilot, Google Gemini, and Perplexity-- delivering reliable and actionable results across leading GenAI platforms.
Value of the Prompt
This prompt builds on provided examples, allowing for faster and more targeted test case generation.
Hands-On Exercise
Use the examples provided to generate additional test cases for a resource allocation feature. Experiment with edge scenarios like limited resources or high demand.
Want More?
Expand the examples to include more complex scenarios and watch how the tool adapts to generate targeted test cases. Experiment with edge cases to challenge system behavior.
Author
Ashwin Palaparthi
© 2023 Ai4Testers.com™ All rights reserved | Made with ❤️ by ContentShastra.com™
Check your inbox to confirm your subscription to Ai4Testers™. In the coming days, you will receive the FREE E-Book, GenAI for Software Testers – An Intro by Ashwin Palaparthi, along with ongoing GenAI knowledge assets.