CT-GenAI: Prompt Structure, Prompting Techniques and System vs User Prompts
Effective prompt development is the practice of writing prompts that let a large language model carry out a software test task accurately: a clear structure of six components, the right prompting technique for the task, and a sensible split between the system prompt and the user prompt. This lesson covers CT-GenAI syllabus section 2.1: the role, context, instruction, input data, constraints and output format components and how to identify them in a prompt; the three core techniques of prompt chaining, few-shot prompting and meta prompting, including zero-shot and one-shot; and how system prompts and user prompts differ and work together.
On this page10 sections
- What a structured prompt is: the six components
- Role and context: who answers, and about what
- Instruction, input data and constraints: the task, its material and its limits
- Output format: shaping the response
- Identifying the components in a given prompt
- Prompt chaining: one step at a time, checked
- Zero-shot, one-shot and few-shot prompting
- Meta prompting: letting the LLM help write the prompt
- Telling the techniques apart and combining them
- System prompts and user prompts
- Give examples of the six components of a structured prompt for software testing: role, context, instruction, input data, constraints and output format
- Identify each component in a given prompt, and spot a component that is missing
- Choose the component that fixes a specific weakness in an LLM's output
- Differentiate prompt chaining, few-shot prompting and meta prompting, and zero-shot from one-shot and few-shot
- Identify the techniques used, alone or combined, in a given prompting example
- Distinguish system prompts from user prompts and decide which content belongs in each
What a structured prompt is: the six components
A structured prompt is a prompt built from six named components (role, context, instruction, input data, constraints and output format) so that the model receives everything it needs to do a test task, stated clearly and in the right place. The CT-GenAI syllabus treats this structure as the basis of effective prompt development: each component adds clarity and precision, and together they communicate the tester's requirements and expectations to the LLM.
Structure alone is not the whole method. The syllabus says the six-component structure should be combined with prompting techniques (prompt chaining, few-shot prompting and meta prompting), chosen according to the task and the LLM in use. In a chatbot or assistant, the components can also be split between a system prompt that stays fixed and the user prompt that changes with each request. This lesson covers all three parts of syllabus section 2.1.
The payoff is practical. When an LLM returns generic, off-target or badly shaped output, the cause is usually a missing or weak component. Knowing what each component does lets you diagnose the problem and add the right thing, instead of rewriting the whole prompt at random.
Each of the six components answers a different question the model would otherwise have to guess. The table summarises them with a test-design example of each.
| Component | What it does | Example line |
|---|---|---|
| Role | Sets the perspective or persona the model takes, which shapes its responsibilities, tone and approach | "Act as a senior tester experienced in accessibility testing." |
| Context | Gives background the model needs to determine test conditions: the test object, the functionality under test, relevant circumstances | "The test object is a parking app for city car parks; this sprint adds pre-booking of spaces." |
| Instruction | States the task to perform and its requirements, in clear, imperative and concise wording | "List the boundary values of every numeric field in the requirement below, with the expected result at each." |
| Input data | Supplies the material the task works on: user stories, acceptance criteria, screenshots, code, existing test cases, output examples | The attached requirement REQ-88 and two screenshots of the pre-booking screen |
| Constraints | Restricts how the instruction is applied to the input data: scope, exclusions, special rules | "Consider pre-booking only; base every expected result on REQ-88." |
| Output format | Specifies the expected format, structure or characteristics of the response | "Number each item and give it a priority of high, medium or low." |
Not every prompt needs a long line for each component, but a prompt that leaves one out leaves that decision to the model. The sections below show how to tell the near-twin components apart, because that is where most mistakes happen.
Role and context: who answers, and about what
The role tells the model whose perspective to take; the context tells it what situation it is working in. They are easy to confuse because both come early in a prompt, but they fix different problems.
- Role examples from the syllabus are a tester, a test manager or a test automation engineer. A role changes what the model pays attention to: its responsibilities, tone and approach. Suppose a team asks for feedback on a set of automated UI test scripts and the answer comments only on the business wording of the steps. The perspective is what needs to change, so the prompt gains a role such as "a test automation engineer who maintains large UI suites", and the feedback turns to maintainability, flaky waits and duplicated locators.
- Context describes the test object and its circumstances: what the product is, who uses it, under which conditions, what this release changes. Suppose generated tests for a museum's ticket kiosk assume a keyboard and a signed-in user, when the kiosk has only a touch screen and serves walk-up visitors. Those are facts about the product and its operating conditions, so they belong in the context. Facts like these reach the model only when the prompt states them.
A quick test: a sentence about who the model should be is role; a sentence about the product, its users or the release is context.
Instruction, input data and constraints: the task, its material and its limits
The instruction is the task; input data is what the task is performed on; constraints limit how the task is applied to that data.
Instruction
The syllabus asks for instructions that are clear, imperative and concise and that include the task description and any relevant requirements. A request such as "Have a think about these requirements" names no task, so the model has to guess what to deliver. "List the boundary values of every numeric field in the requirement below, with the expected result at each" states the task and its requirements in one imperative sentence.
Input data
Input data is any information needed to perform the task: user stories, acceptance criteria, screenshots, code, existing test cases or output examples. The syllabus stresses that detailed, structured input data produces more accurate, context-aware results. Specific business rules are a good illustration. If a loyalty scheme caps the points earned per order and lets unused points lapse after a set period, test cases can check those rules only when the model can read them, so the requirement or acceptance criteria that state them go into the prompt as input data.
Context versus input data is the most common confusion. Context describes the product and situation in the prompt writer's own words; input data is the material itself: the attached story, the screenshots, the OpenAPI excerpt, existing test cases.
Constraints
Constraints are restrictions or special considerations: scope limits ("cover the search filters only", "apply boundary value analysis to the quantity field only"), exclusions ("leave the admin pages out"), and rules about which sources to rely on ("base every expected result on the attached requirement"). The distinction from the instruction is that a constraint does not name a new task; it narrows how the stated task is carried out.
Constraints also let you keep useful input data while controlling how it is used. Screenshots from a staging system might show real employee email addresses, yet the team wants them in the prompt so the model sees the exact screen layout. A constraint such as "mask every email address in your output and test the profile-settings screen only" keeps the layout information and sets the rules for how it is used.
Output format: shaping the response
The output format component specifies the format, structure or characteristics of the response, so the result can be used without reworking. Typical examples in testing are a table with named columns, a numbered list with one condition per line, Given/When/Then scenarios, or CSV with defined columns for import into a test management tool.
Tell output format apart from its neighbours by asking what the line controls:
- "Write each scenario in Given/When/Then form, one scenario per block" controls the shape of the answer: output format.
- "Design scenarios for the feature that exports Gherkin files" names a task that happens to mention a format: instruction.
- "Leave out scenarios for the administrator role" restricts scope: constraint.
Output format fixes presentation problems. It does not fix a wrong perspective, missing domain knowledge or missing rules; those need role, context or input data.
Identifying the components in a given prompt
To identify the components of a prompt, classify each line by the job it does, not by where it sits or which words it uses. The syllabus hands-on objective HO-2.1.1 is exactly this: read a structured prompt and see how each component contributes.
1 You are a tester who specialises in mobile accessibility.
2 The app lets gym members book classes; v3 adds voice control.
3 Identify test conditions for booking a class by voice.
4 <requirement REQ-41 and its acceptance criteria>
5 Ignore the web version of the timetable.
6 Group the conditions under the headings Happy path and Errors.
Line 1 is the role; line 2 is context (background on the product and the release, in the writer's words); line 3 the instruction; line 4 input data; line 5 a constraint (it limits how the instruction uses the input); line 6 the output format.
Two habits help:
- Check for what is missing. Run through all six components and ask which one has no line. If the prompt above stopped after line 5, it would have no output format, and the model would choose the layout itself. Spotting the absent component is as important as labelling the present ones.
- Treat a worked example as input data. A line such as
Input: quantity=0 → Expected: "Enter at least 1"shows the expected result for an input. The syllabus lists output examples under input data, and a prompt with exactly one such example is one-shot prompting. A line that tells the model how to lay out all of its answers, such as "Follow this pattern for each case", is the output format.
Prompt chaining: one step at a time, checked
Prompt chaining breaks a task into a series of intermediate steps, each its own prompt, and checks and refines the result of each step (manually or automatically) before moving to the next. Because each checked response feeds the next prompt, errors are caught where they arise instead of flowing silently into the final output, which gives greater accuracy.
The syllabus says chaining is particularly useful when test tasks are complicated and need decomposition into subtasks with systematic checking of intermediate outputs, and that it allows dynamic interaction in test processes. A chain for risk-based testing of a new feature might look like this:
- Ask for the product risks the release notes suggest; review the list and remove any that do not apply.
- Ask the model to rate the remaining risks by likelihood and impact; adjust the ratings.
- Ask for test cases that cover the highest-rated risks.
The checkpoints are the point of the technique. Each one gives the tester a small, reviewable result, so a mistake is corrected at the step where it appeared, and the final output rests on intermediate results that someone has already approved. A single prompt that asks for the whole job at once has no such checkpoints, which is why large or multi-stage test tasks are where chaining pays off.
Chaining fits multi-step work; for keeping output in a particular style, examples are the tool (next section).
Zero-shot, one-shot and few-shot prompting
Few-shot prompting means putting examples of the expected result in the prompt. The syllabus defines the three levels by the number of examples:
| Level | Examples in the prompt | What the model relies on |
|---|---|---|
| Zero-shot | None | Its pre-existing knowledge and the wording of the prompt |
| One-shot | One example showing the expected result for a given input | That single demonstration |
| Few-shot | More than one (a few) | Several demonstrations that further consolidate the desired behaviour |
Examples give the model a clear reference, which makes results consistent and in line with expectations. Few-shot prompting is most effective where examples can illustrate the required behaviour better than a description can, so the model generalises from them. A team's defect report style is a good case: a summary line built a particular way, numbered reproduction steps and a fixed set of fields are easier to show than to describe, so a few completed reports in that style show the model exactly what to produce.
Two cautions follow from how examples work:
- Vary the examples. This is good practice rather than syllabus text: a model tends to copy whatever its examples have in common. If every example booking in a prompt is for a single traveller paying in euros, generated bookings may all look the same. Examples that span the valid range of each field (group bookings, other currencies) keep the format guidance and widen the output.
- Count carefully. One example plus a new input to process is one-shot, not few-shot. Two or more is few-shot.
Meta prompting: letting the LLM help write the prompt
Meta prompting uses the LLM's ability to generate or refine prompts. In an iterative cycle, the LLM generates a prompt, the tester evaluates and refines it, and the improved prompt is then used for the actual test task. It takes advantage of the model's knowledge of what makes prompts effective.
The syllabus names two benefits:
- Efficiency and prompt optimisation. Meta prompting is especially useful when efficiency and prompt optimisation are critical, because it reduces the manual effort required to design effective prompts. A team that needs well-built prompts quickly can have the LLM draft them and spend its own time reviewing them.
- Help when you are unsure. A tester who does not know how to craft an effective prompt can co-create it with the LLM. The syllabus calls this a form of pairing with the GenAI tool: the tester and the AI work together interactively towards a shared goal. The syllabus adds that this way of collaborating with AI tools enhances productivity and learning in prompt engineering, and also in pair programming and pair testing.
The human stays in charge: the LLM drafts, the tester evaluates and decides. The syllabus's summary table describes meta prompting as suited to flexible, dynamic tasks and to crafting prompts for new tasks.
Telling the techniques apart and combining them
The three techniques solve different problems, and the fastest way to identify one in an example is to ask what each round produces.
| Technique | What it adds | Each round's output | Best when |
|---|---|---|---|
| Prompt chaining | Decomposition into checked steps | A test artefact (ambiguities, conditions, cases) checked before the next prompt | The task is complex and intermediate results need review |
| Few-shot prompting | Examples inside one prompt | The answer itself, patterned on the examples | Examples show the required format or style better than words |
| Meta prompting | The LLM drafts or improves the prompt | A revised prompt the tester evaluates before using it | Prompt design effort must be low, or the tester is unsure how to word the prompt |
Chaining and meta prompting both run over several rounds with a tester checking in between. Look at what the tester is reviewing: in chaining it is part of the testing work (risks, conditions, test cases); in meta prompting it is the wording of a prompt that will be used later.
The syllabus says the techniques can be used in combination, and the hands-on objective HO-2.1.2b asks you to identify every technique in a given example. For example, a tester might have the LLM draft a prompt for writing Gherkin scenarios and polish it (meta prompting), add three finished scenarios from an earlier project to that prompt (few-shot), and then run it one user story at a time, reviewing each set of scenarios before moving to the next story (chaining). Read each part of the scenario separately and name the technique for each; then check the example count to choose between one-shot and few-shot. Choosing techniques for specific test tasks such as test design or regression automation is covered in the next lesson of this chapter.
System prompts and user prompts
A system prompt is a predefined set of instructions, typically written by the developer or tester who sets up the assistant, that defines the LLM's behaviour, personality and operational parameters for the whole conversation. A user prompt is the chatbot user's actual input or question, and it changes with each interaction.
| System prompt | User prompt | |
|---|---|---|
| Written by | Developer or tester configuring the tool | The chatbot's user |
| Visibility | Usually not visible or editable by the chatbot's user | Directly visible |
| Lifetime | Set once at the start; stays constant for the session | Changes with each interaction |
| Typical content | Role, context, constraints, operational parameters, general output rules | The specific task or question, its input data, relevant context and output format instructions |
Operational parameters determine how the model responds: a formal tone, concise answers, respecting domain-specific rules, avoiding certain behaviour. The syllabus example is a system prompt telling the model it is a professional software testing assistant that answers clearly and formally, follows ISTQB-aligned practices, avoids speculation and cites testing principles. "List the key differences between black-box and white-box testing" is a user prompt: a one-off task.
When splitting content, put what must apply to every request in the system prompt (the role, the organisation's naming convention for test cases, a rule to flag every assumption, a concise style) and what changes per request in the user prompt (this sprint's requirement, the specific task, an attached screenshot). Content placed in the system prompt applies to every later request, so it should hold only what is meant to apply everywhere; standing rules kept there are stated once and stay consistent.
How the model uses both prompts together
For every response, the LLM considers the unchanging system prompt together with the current user prompt. The system prompt sets the rules for the entire conversation, so it applies to the first request and to every later one; the user prompt is the part that changes from turn to turn.
That has two practical consequences:
- A good system prompt does not excuse a vague user prompt. The syllabus requires user prompts to be focused and well structured, with explicit instructions plus relevant context and output format instructions. A system prompt can set the role and the general rules, but only the user prompt can say what this request is about. For a search feature, a focused user prompt names the task (for example, test conditions for the filter combinations), includes the relevant requirement and says how the result should be laid out.
- Per-request needs go in the user prompt. The chatbot's user usually cannot see or edit the system prompt, and should not try to change it for a one-off need. When a single request needs something different from the usual output, for example a numbered checklist where the assistant normally writes prose, the user prompt is the place to say so, explicitly, for that request.
Tip. Questions on this topic are mostly at the understanding level, with some prompt-reading items. Expect to be shown a line or a whole numbered prompt and asked which component a line is, which component is missing, or which component would fix a described weakness in the output; separate near-twins by the job each line does (context describes, input data is the material, constraints restrict, output format shapes). Technique items describe a prompting session and ask which technique or combination of techniques it uses, or which technique suits a situation; count the examples and look at what each round produces. System and user prompt items ask who sets each, what stays constant in a session, what operational parameters are, which content belongs where, and how the model combines the two prompts.
- A structured prompt has six components: role, context, instruction, input data, constraints and output format; combine the structure with prompting techniques.
- Role sets the perspective (tester, test manager, test automation engineer); context describes the test object, its users and the release.
- Instructions are clear, imperative and concise; input data is the material itself (stories, acceptance criteria, screenshots, code, existing tests, output examples).
- Constraints restrict how the instruction is applied to the input data; output format shapes the structure of the response.
- Prompt chaining splits a complex task into prompts and checks each intermediate output before the next step.
- Zero-shot uses no example, one-shot one, few-shot several; examples make output consistent and in line with expectations.
- Meta prompting has the LLM draft or refine prompts that the tester evaluates: efficient, and a form of human-AI pairing.
- Techniques combine; identify each by what is being reviewed between rounds: testing work in chaining, the prompt itself in meta prompting, and examples inside one prompt in few-shot.
- The system prompt is set by the developer or tester, usually hidden, and constant for the session; the user prompt changes with each request.
- The model considers the system prompt and the current user prompt together, so user prompts must still be focused and explicit.
Frequently asked questions
What are the six components of a prompt in CT-GenAI?
The CT-GenAI syllabus lists role (the persona the model takes), context (background on the test object and functionality), instruction (the task, stated clearly and imperatively), input data (user stories, acceptance criteria, screenshots, code, existing test cases or output examples), constraints (restrictions on how the instruction is applied) and output format (the expected structure of the response).
What is the difference between context and input data in a prompt?
Context is background the prompt writer describes, such as what the product is, who uses it and what the release changes. Input data is the material the task works on, supplied as-is: the user story and acceptance criteria, screenshots, code, existing test cases or output examples.
What is prompt chaining in software testing?
Prompt chaining breaks a test task into a series of prompts, such as finding ambiguities, then deriving test conditions, then writing test cases, and checks and refines each intermediate result before the next step. It suits complex tasks because errors are caught where they arise.
What is the difference between zero-shot, one-shot and few-shot prompting?
Zero-shot prompting gives no example and relies on the model's pre-existing knowledge. One-shot prompting includes one example of the expected result for an input. Few-shot prompting includes several examples, which consolidates the desired behaviour and makes output more consistent.
What is meta prompting?
Meta prompting uses the LLM to generate or refine the prompt itself. The LLM drafts a prompt, the tester evaluates and refines it, and the result is used for the test task. It reduces manual prompt design effort and is a form of pairing in which tester and AI co-create the prompt.
What is the difference between a system prompt and a user prompt?
A system prompt is set by the developer or tester, is usually not visible or editable by the chatbot's user, and stays constant for the session; it holds the role, context, constraints and operational parameters such as tone. A user prompt is the user's input, changes with each interaction and carries the specific task.
Does a good system prompt mean user prompts can be short?
No. The model considers the system prompt together with the current user prompt, so a vague user prompt still produces generic output. User prompts should be focused and well structured, with explicit instructions, relevant context and input, and output format instructions where needed.
Source
This lesson covers the "Prompt Engineering for Effective Software Testing" domain of the official CT-GenAI exam guide. Vendors revise their guides — check the source for the current version.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.