SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
Prompt Engineering for Effective Software Testing

CT-GenAI: Evaluating GenAI Test Results and Refining Prompts

15 min readCT-GenAI · Prompt Engineering for Effective Software TestingUpdated

Evaluating generative AI results means measuring the test cases, scripts and other artefacts an LLM produces against clear metrics, then using what the measurements show to refine the prompt that produced them. This lesson covers CT-GenAI syllabus section 2.3: the seven general metrics (accuracy, precision, recall, relevance and contextual fit, diversity, execution success rate and time efficiency), task-specific metrics, manual and automated evaluation, why non-deterministic output needs statistically relevant data, the five techniques for evaluating and iteratively refining prompts, and how teams share what works through optimization sessions and prompt libraries.

What you’ll learn
  • Describe the seven general metrics for evaluating GenAI results on a test task and give a testing example of each
  • Distinguish accuracy, precision and recall, and read precision and recall from a simple set of results
  • Recognise which metric a described strength or weakness of generated tests affects, including when two metrics disagree
  • Explain task-specific metrics and when metrics are evaluated by manual review or automatically against a predefined reference
  • Explain why GenAI's non-determinism means metrics must rest on statistically relevant data
  • Give examples of the five techniques for evaluating and iteratively refining prompts and choose one that fits the evidence
  • Explain how prompt optimization sessions and shared prompt libraries support consistent quality across test teams

Why GenAI test output needs measuring

GenAI output for a test task needs measuring because an LLM can return test cases that look complete and well written while being wrong, incomplete, repetitive or unusable, and only an explicit evaluation shows which. The CT-GenAI syllabus says that evaluating GenAI in software testing requires a clear set of metrics to assess the quality, relevance and effectiveness of the generated outputs, and that these metrics, whether general or task-specific, help optimize LLM prompting.

Section 2.3 has two halves that depend on each other:

  • Metrics (2.3.1) tell you how good the output is, and in which way it falls short: correctness, completeness, fit to the context, variety, executability and effort saved.
  • Evaluation and refinement techniques (2.3.2) use those readings to improve the prompt: modify it step by step, compare versions, analyse errors, listen to the testers who use the output, and tune the prompt's length and detail.

The link between them is the point of the topic. A refinement is only an improvement if a metric shows it, and a metric is only useful if it points to something in the prompt you can change. The syllabus hands-on objectives make the same connection: first observe task-adapted metrics applied to real LLM results (HO-2.3.1), then start from an initial prompt and refine it using techniques such as A/B testing and human verification (HO-2.3.2).

The seven general metrics for GenAI results

The syllabus lists seven general metrics for evaluating the quality and efficiency of GenAI results on a test task. Each one asks a different question about the output, and each comes with a typical testing example.

MetricWhat it measuresTesting example
AccuracyOverall correctness of the generated output against expert-written test cases, requirements or other standardsHow far the generated test cases cover all the specified requirements, or agree with an expert-written reference set
PrecisionCorrectness of the output with respect to one specific objectiveHow correctly the generated test cases identify anomalies: of everything flagged, how much is real
RecallAbility to identify all relevant instances within a data setHow far the generated test cases cover the valid and invalid equivalence partitions of a data class
Relevance and contextual fitWhether the output is applicable and appropriate for the given contextHow consistent the test cases are with the test basis and whether they integrate domain-specific requirements
DiversityWhether a wide range of inputs and scenarios is covered, without repetitionHow far the test cases cover different user behaviours and explore edge cases
Execution success rateProportion of generated test artefacts that run successfully as is in the test environmentHow many generated test scripts execute without syntax errors or output format issues
Time efficiencyTime saved compared with manual test effortTime the AI needs to generate test cases versus the time a person would need to create equivalent tests by hand

A useful way to group them: accuracy, precision, recall and relevance judge whether the content is right; diversity judges whether it is varied; execution success rate judges whether it is usable without repair; time efficiency judges whether it was worth generating at all. Time efficiency is the only one that says nothing about the quality of the output itself.

Accuracy, precision and recall: telling the near-twins apart

Accuracy, precision and recall all deal with correctness, but each looks from a different angle: accuracy is correctness overall, precision is correctness of what was produced for one objective, and recall is completeness against everything that should have been found.

  • Accuracy compares the output as a whole with a trusted standard, such as the requirements or a reference suite written by domain experts. Ask: does the generated material agree with what experts or the requirements say is correct?
  • Precision narrows that to a single objective, typically finding anomalies. It looks only at what the output claims. Ask: of the things it flagged, how many are real? Many false alarms mean low precision, however many real defects are among them.
  • Recall looks at what the output should have caught. Ask: of all the relevant instances, how many did it find? Missing partitions, missing defects or missing cases mean low recall, however correct the produced cases are.

A worked example with made-up numbers: a reference data set contains 20 known defects. Generated tests flag 25 items, of which 15 are real defects.

ReadingCalculationResult
Precisionreal defects among the flagged items: 15 of 2560%
Recallknown defects that were found: 15 of 2075%

The two readings can move independently, so a prompt is judged on both rather than on whichever number looks better. To calculate precision you need only the flagged items and a check of each; to calculate recall you also need to know the full set of relevant instances, which is why seeded defects or a defined set of partitions are used.

Reading several metrics together

No single metric describes GenAI test output fully: a set of tests can score high on one metric and low on another, so evaluations combine metrics to see where the output actually falls short. The pairs below are the ones most easily confused.

PairHow they differOutput that splits them
Execution success rate vs accuracyExecution success only asks whether artefacts run as is; accuracy asks whether they check the right thingsInvoice-calculation API tests that compile and pass because their expected totals were copied from the current build, not taken from the pricing rules: they run, but they do not check what the requirements say
Recall vs diversityRecall is completeness against a defined set (such as the partitions of a field); diversity is variety of user behaviours, inputs and edge cases without repetitionShipping-rate tests that reach every weight band and every destination class, yet each one is a single parcel entered by a returning customer: complete against the defined classes, narrow in behaviour
Diversity vs accuracyTests can all trace correctly to the requirements and still repeat the same happy pathHotel-booking cases that each trace correctly to a requirement, but every one books a standard room for two adults for one night
Relevance and contextual fit vs execution successContextual fit asks whether the tests belong to this system, its test basis and its domain rulesRunnable tests for a hospital prescribing system that never touch dosage limits or the audit rules set out in its test basis
Accuracy vs relevance and contextual fitAccuracy compares with a reference or requirements for correctness; contextual fit asks whether the output suits the domain and integrates its specific requirementsGeneric test ideas that are not wrong but take no account of the domain's constraints

When an evaluation finds one strength and one weakness in the same output, name each with its own metric. A good score in one area does not make up for a poor score in another, and the weak metric is the one that tells you what to change in the prompt.

Task-specific metrics and how metrics are evaluated

Beyond the seven general metrics, the syllabus says task-specific metrics can be tailored to evaluate how well GenAI supports a particular test activity. The general list is a starting point; a team generating keyword-driven scripts, analysing test reports or prioritising regression tests can define measures that reflect what that activity needs. A task-specific metric is tied to the test activity and its goal. For regression test prioritisation, for example, a team might measure how many of the historically failure-prone areas the model places in the first part of the run; for test report analysis, how many failures it groups under the right root cause.

The syllabus gives two ways to evaluate metrics, and they are often combined:

ApproachHow it worksSuits
Manual reviewTesters or domain experts read and judge the outputJudgements that need knowledge not written down anywhere, such as unwritten domain rules or how useful a test really is; smaller volumes
Automated evaluationA tool calculates the metric, for example by comparing the LLM output with a predefined reference, or by running generated scripts to see whether they executeLarge or repeated volumes, and properties that can be checked mechanically, such as executability or agreement with a reference set

The deciding questions are volume and whether a reference exists. A team that generates thousands of test data records each release can validate them against a schema or a reference data set by tool, which no reviewer could match at that scale. Whether a generated scenario respects an insurer's long-standing underwriting practice is a different matter: if that practice is not documented, a tool has nothing to compare against and a specialist has to judge it. Writing such knowledge down as a reference is what later makes automated evaluation possible.

Non-determinism: why one run proves nothing

GenAI metrics must rest on statistically relevant data, because an LLM is non-deterministic: the same prompt with the same input can produce different output on different runs. The syllabus states this directly: given the non-deterministic nature of GenAI, the metrics must be based on statistically relevant data.

In practice this means:

  • One good run is not evidence. A refined prompt that produced better tests once may simply have been lucky; run it enough times to see its typical result before declaring it an improvement.
  • Compare like with like. A fair comparison of prompt versions holds everything except the prompt constant: the same test basis, the same model and settings, and a similar amount of evidence for each version. Otherwise the comparison measures luck or input differences rather than the prompt.
  • Look at spread, not just averages. A prompt that is excellent sometimes and poor sometimes may be less useful than one that is reliably good, because the tester cannot tell in advance which run they will get.

This rule applies to every metric and every technique in this lesson. It is what turns A/B testing of prompts from an impression into a measurement.

Five techniques for evaluating and refining prompts

The syllabus names five techniques that build on the metrics to evaluate prompts and improve AI results. Each starts from a different source of evidence.

TechniqueWhat you doEvidence it uses
Iterative prompt modificationStart with a base prompt and modify it step by step based on the actual results, gradually adding context or adjusting wording (for example the terminology) to improve specificity and relevanceThe results of each previous version of the one prompt
A/B testing of promptsCreate several versions of a prompt and evaluate which produces better results against predefined metrics, to find the phrasing or structure that gives the most accurate and relevant outputMetric scores of parallel versions
Output analysisExamine the generated output for inaccuracies or inconsistencies, for example with the test basis, and understand the types of errors so the prompt can be refined to avoid similar defects in future iterationsThe errors in the output itself
Integrating user feedbackGather input from the testers who use the output about its usefulness and clarity, for example the level of detail of the generated tests, analyse it and refine the prompt to meet real testing needsThe views of the people using the output
Adjusting prompt length and specificityExperiment with different prompt lengths and levels of detail: sometimes more context improves the response; in other cases shorter prompts generalise betterComparing results across longer and shorter versions

The techniques are not alternatives to choose between once. A team typically analyses the output to find error types, modifies the prompt in response, A/B tests the new version against the old one over enough runs, and checks with testers whether the result is actually more useful.

Choosing the right refinement for the evidence

The right refinement depends on what the evaluation found, and the near-twin techniques are separated by their evidence and their method.

  • Iterative modification vs A/B testing. Iterative modification refines one prompt in sequence, each change prompted by the last result. A/B testing compares several versions side by side on agreed metrics. A tester who keeps editing one prompt after each review is iterating; a tester who writes three phrasings and scores them is A/B testing.
  • Iterative modification vs adjusting length. What defines the technique is why the prompt changes. Iterative modification responds to the last results with whatever change they call for, which may make the prompt longer. Adjusting length and specificity is a deliberate experiment with how much detail to give, in either direction, with the versions compared afterwards.
  • When shorter may be better. The syllabus says only that more context sometimes helps and shorter prompts sometimes generalise better. One way this can show up: a prompt packed with detailed constraints for one feature may steer every output towards those constraints, and a leaner version may give a broader spread. Neither direction is assumed; the versions are compared over enough runs.
  • Output analysis vs user feedback. Output analysis checks the content against the test basis and classifies the errors (for example a business rule stated wrongly). User feedback reports whether the output is useful to the people who work with it, for example whether its level of detail and wording suit them. Error types found by analysis usually lead to correcting or adding the context the model got wrong; feedback on usefulness usually leads to changing what the prompt asks for, such as the format, granularity or audience.
  • Metrics and feedback together. The agreed metrics show whether a version is better on measurable properties; testers' views on clarity and usefulness add evidence that those metrics do not capture. Integrating user feedback is one of the five techniques, so it counts as evidence alongside the scores.

All five techniques change the prompt and then measure the effect. Prompt chaining, few-shot and meta prompting are prompting techniques from section 2.1, covered in the lesson on prompt structure and techniques.

Prompt optimization sessions and shared prompt libraries

Test teams can use the five techniques to organise prompt evaluation and optimization sessions that keep improving their GenAI prompts, and share what they learn across the team or the whole test organization. The syllabus says that sharing practices:

  • helps standardise prompt techniques and maintain consistent quality between teams and projects;
  • promotes a culture of learning and iterative improvement;
  • lets teams build on collective insights, avoid repeated errors and refine their use of GenAI tools over time, for example by sharing prompt libraries.

In practice a session might take one recurring task, such as drafting acceptance tests from user stories, settle what will count as a better result before anyone runs a prompt, try the candidate prompts with repeated runs, and then record the winning prompts, with their measured results and what was learned from the weaker ones, where other teams can find them. Because models, products and needs change, library entries are revisited too: continuous improvement applies to the library as much as to any single prompt.

Tip. Questions on this topic are at the understanding level and often describe generated test output or a team's evaluation activity. Metric items give a description or a small set of results and ask which metric it reflects, which metric scores lowest, or which two statements about several metrics are correct; some include counts from which precision and recall must be read, and many contrast a near-twin pair such as recall and diversity, accuracy and execution success rate, or accuracy and relevance. Other items ask how to evaluate metrics (manual review or automated comparison with a reference) and why one run is not enough. Technique items describe a refinement activity and ask which technique it is, or give evaluation evidence (metric scores, error types, testers' comments) and ask which refinement or next step fits best, including how teams share prompt practices.

Key takeaways
  • Accuracy is overall correctness against expert-written tests, requirements or other standards; precision is correctness for one objective (of what was flagged, how much is real); recall is finding all relevant instances (such as every valid and invalid partition).
  • Relevance and contextual fit asks whether output is consistent with the test basis and the domain's requirements; diversity asks whether it covers varied user behaviours and edge cases without repetition.
  • Execution success rate counts generated artefacts that run as is, without syntax or format errors; it says nothing about whether they check the right results.
  • Time efficiency compares AI generation time with the manual effort for equivalent tests; it is the one metric that does not judge output quality.
  • Task-specific metrics can be tailored to how well GenAI supports a particular test activity, on top of the general metrics.
  • Metrics are evaluated by manual review or automatically, for example against a predefined reference; volume and the existence of a reference decide which.
  • GenAI is non-deterministic, so metrics must rest on statistically relevant data: one run proves nothing, and compared versions need comparable runs on the same inputs.
  • The five refinement techniques are iterative prompt modification, A/B testing of prompts, output analysis, integrating user feedback, and adjusting prompt length and specificity.
  • Sharing practices and prompt libraries across teams standardises techniques, keeps quality consistent and helps teams avoid repeating errors.

Frequently asked questions

What metrics does CT-GenAI use to evaluate GenAI results on test tasks?

The CT-GenAI syllabus lists seven general metrics: accuracy (overall correctness against expert-written tests, requirements or standards), precision (correctness for a specific objective such as identifying anomalies), recall (finding all relevant instances, such as every valid and invalid equivalence partition), relevance and contextual fit (consistency with the test basis and domain requirements), diversity (varied inputs, user behaviours and edge cases), execution success rate (artefacts that run as is) and time efficiency (time saved versus manual effort). Task-specific metrics can be added for particular test activities.

What is the difference between precision and recall for generated tests?

Precision looks at what the generated tests flagged and asks how much of it is correct, so many false alarms mean low precision. Recall looks at everything that should have been found and asks how much was found, so missed defects or missing partitions mean low recall. A prompt can score high on one and low on the other, which is why GenAI test output is evaluated on both.

Why must GenAI metrics be based on statistically relevant data?

Generative AI is non-deterministic: the same prompt can give different output on different runs. A single good or bad run therefore says little about a prompt, so the CT-GenAI syllabus requires metrics to be based on statistically relevant data, meaning enough runs, and comparable runs on the same inputs when prompt versions are compared.

Should GenAI test output be evaluated manually or automatically?

Either, and often both. Automated evaluation, for example comparing output with a predefined reference or running generated scripts, suits large or repeated volumes and mechanically checkable properties. Manual review by testers or domain experts is needed when the judgement depends on knowledge that is not written down, so there is nothing to automate against.

What are the techniques for refining prompts in CT-GenAI?

The CT-GenAI syllabus names five: iterative prompt modification (refine one base prompt step by step from its results), A/B testing of prompts (compare several versions on predefined metrics), output analysis (find and classify inaccuracies against the test basis), integrating user feedback (use testers' views on usefulness, clarity and level of detail) and adjusting prompt length and specificity (try more or less context and detail).

How is A/B testing of prompts different from iterative prompt modification?

A/B testing creates several prompt versions and compares them side by side against predefined metrics to choose the best phrasing or structure. Iterative prompt modification works on one prompt in sequence, changing it after each set of results, for example by adding context or adjusting terminology. Both rely on enough runs to be statistically meaningful.

Is a longer, more detailed prompt always better?

No. The CT-GenAI syllabus says adding context sometimes improves the response, but in other cases shorter prompts generalise better. Neither direction is a rule, so testers experiment with different lengths and levels of detail on the same task and compare the results over enough runs.

Why share prompt libraries across test teams?

Sharing prompt practices and libraries standardises prompt techniques, keeps output quality consistent between teams and projects, lets teams build on what others have learned and stops them repeating the same prompt mistakes. Prompt evaluation and optimization sessions feed the library, so it keeps improving over time.

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.

Spotted a mistake in this lesson?