Prompt Engineering for Software Testers: The 5-Part QA Prompt Formula
A vague question gets a vague answer. That is true for people, and it is true for AI. This lesson teaches prompt engineering for software testers using one simple formula with five parts. You can use it on your very next task.
📖 What You’ll Learn
- What a prompt is, and what makes one strong
- The five parts of a good QA prompt
- How to turn a weak prompt into a strong one
- When to add each part, and when to leave it out
💡 What Is a Prompt?
Explain Like I’m 5: Prompt
Imagine: You ask a friend to fetch “a snack”. You might get anything. If you say, “Please bring one red apple from the kitchen table,” you get exactly that.
What it really means: A prompt is the instruction you give to AI. Clear instructions give better results.
In testing: “Test login” is the vague request. A full feature description is the clear one.
A prompt is the message you send to an AI assistant. Prompt engineering is the skill of writing that message so the answer is useful. It is not magic wording. It is clear communication, which good testers already practise in bug reports.
🔍 Prompt Engineering for Software Testers: The 5-Part Formula
Explain Like I’m 5: The 5-Part Formula
Imagine: Think of ordering a birthday cake. You say who it is for, what the party is like, what cake you want, what it must not contain, and what shape it should be.
What it really means: A strong prompt also has five parts: role, context, task, constraints and format.
In testing: Every part removes one guess the AI would otherwise make.
| Part | The question it answers | QA example |
|---|---|---|
| Role | Who should the AI act as? | A senior QA engineer in banking |
| Context | What does it need to know? | The user story and business rules |
| Task | What must it do? | Write test scenarios for password reset |
| Constraints | What are the limits? | Use only the rules given, and list open questions |
| Format | How should the answer look? | A table with ID, steps, data and expected result |
Here is an easy way to remember the order: who, what we know, what to do, what to avoid, how to show it.
🧩 Why Each Part Matters
Role
Explain Like I’m 5: Role
Imagine: When you play doctor, you talk about medicine. When you play chef, you talk about food.
What it really means: The role tells the AI which kind of knowledge and language to use.
In testing: “Security tester” brings different ideas than “accessibility tester”.
A role sets the point of view. It does not give the AI real experience, so it never replaces your review.
Context
Context is usually the most valuable part. Share the requirement, the business rules and the user type. Follow the data rules from AI Data Privacy for Testers before you paste anything.
Task
Ask for one clear job. “Write 10 negative test scenarios” is better than “help me with testing”. If a task has several stages, split it up. You will learn how in Lesson 8.
Constraints
Constraints protect you from AI hallucinations in software testing. The most useful constraint for testers is simple: do not invent rules, and list what is missing.
Format
Tell the AI exactly how to lay out the answer. A fixed layout is faster to review and easier to copy into your test tool.
🌍 Real-Life Example: Password Reset
Weak prompt:
Write test cases for password reset.
The AI has to guess the rules, so you get a generic list.
Strong prompt:
ROLE: You are a senior QA engineer testing a banking website.
CONTEXT: A user can request a password reset link by email.
- The link expires after 30 minutes.
- The link works only once.
- A new password must be 8 to 20 characters long.
- The new password cannot match the last 3 passwords.
TASK: Write 10 test scenarios for this feature. Include positive,
negative and boundary scenarios.
CONSTRAINTS: Use only the rules above. Do not invent any screens or
rules. If something is unclear, add it to a list called
"Questions for the product owner".
FORMAT: Return a table with ID, Scenario, Test Data, Expected Result
and Type.
Now the AI can include useful boundaries, such as passwords of 7, 8, 20 and 21 characters. It can also test a link at 29 and 31 minutes.
📌 When to Use a Shorter Prompt
You do not need all five parts every time. A quick question like “What does HTTP 403 mean?” needs no role or format. Use the full formula when the output will enter your real test work.
🧪 Try It Yourself
- Open the Dummy Banking Website and pick one feature.
- Write a one-line prompt for that feature, and save the answer.
- Fill in the five-part template below, using made-up details only.
- Open a new chat and run the full prompt.
- Compare both answers. Count the scenarios you would really use.
📋 Ready-to-Copy Prompt
ROLE: You are a senior QA engineer with experience in [domain].
CONTEXT:
Feature: [feature name]
User type: [who uses it]
Business rules:
- [rule 1]
- [rule 2]
TASK: Write [number] test scenarios covering positive, negative and
boundary cases.
CONSTRAINTS:
- Use only the information above.
- Do not invent screens, fields or rules.
- List anything unclear under "Questions for the product owner".
FORMAT: Return a table with ID, Scenario, Test Data, Expected Result
and Type (Positive, Negative or Boundary).
⚠️ Common Mistakes
- Asking for “all possible test cases”, which has no clear end
- Leaving out the business rules and then blaming the AI
- Giving several unrelated jobs in one prompt
- Forgetting to say what format you want
- Thinking a role such as “expert” makes the answer correct
🎯 Key Takeaways
- A prompt is an instruction, and clear instructions give better results.
- Use five parts: role, context, task, constraints and format.
- Context and constraints do the most to improve QA output.
- You still review the answer, however good the prompt is.
🎤 Interview Questions
1. What is prompt engineering, and why does it matter for testers?
Model answer: Prompt engineering is writing clear instructions so an AI tool gives useful output. It matters for testers because generic prompts produce generic test cases. When I supply business rules and limits, the result is more relevant and easier to review.
2. What makes a good QA prompt?
Model answer: I include a role, the context, one clear task, constraints and an output format. For example, I give the acceptance criteria, ask for boundary and negative scenarios, tell the AI not to invent rules, and request a table.
3. How do you stop AI from inventing requirements?
Model answer: I paste the actual requirement, tell the AI to use only that text, and ask it to list missing information as questions. This lowers the risk but does not remove it, so I still trace each test case back to the requirement.
4. Does assigning a role such as “senior QA engineer” guarantee better answers?
Model answer: No. A role can guide the style and focus of the answer, but it does not give the model real project knowledge or make it accurate. Specific context and my own review have a much bigger effect on quality.
5. Give an example of improving a weak prompt.
Model answer: “Write test cases for login” is weak. I would state the user type, password rules and lockout limit, ask for positive, negative and boundary scenarios, forbid invented rules and request a table. Replace this with a prompt you have really improved at work.
📝 Assignment
Rewrite three prompts you have used before with the five-part formula. For each one, record the old prompt, the new prompt and what improved. Save the best one, because you will add it to your prompt library in Lesson 11.
❓ FAQ
Does the order of the five parts matter?
The order is not a strict rule. Keeping the same order simply makes prompts easier to write, read and reuse.
Will this formula work with any AI assistant?
The idea works with any mainstream chat assistant. Answers will differ between tools, so test important prompts in the tool your team uses.
🚀 Next Steps
Well done on finishing this lesson. Complete the assignment, then continue with Few-Shot Prompting for Test Cases: Teach AI Your Team’s Format.