Engineering leads and QA managers use this prompt when they need to extract a consistent, actionable signal from a wall of unstructured test run output. The ideal user is someone responsible for a release decision, a CI pipeline health dashboard, or an incident response channel who receives thousands of lines of logs, stack traces, and duration metrics from tools like Pytest, JUnit, or Go test. The job-to-be-done is not to replace a dedicated test analytics platform, but to act as the reliable extraction layer that turns raw, noisy output into the structured input those platforms, dashboards, and notification systems require. You should use this prompt when you need a machine-readable JSON report that highlights failures, identifies flaky tests, quantifies coverage changes, and flags trend anomalies against a known baseline.
Prompt
Test Report Summarization Prompt

When to Use This Prompt
Identify the right conditions for transforming raw test output into a structured, machine-readable summary.
This prompt is designed for post-execution summarization, not for real-time streaming analysis or as a substitute for a test runner's native reporting. It works best when you provide the complete, unredacted test output as [INPUT] along with a [BASELINE] of previous run statistics to enable trend detection. The prompt requires a defined [OUTPUT_SCHEMA] so that the generated report can be ingested programmatically. For example, you might specify a schema that includes failed_tests as an array of objects with name, error_message, and file_path, and flaky_tests as an array of objects with name and consecutive_failure_count. Without a strict schema, the model may produce a human-readable summary that is difficult to parse in a CI pipeline. You should also provide [CONSTRAINTS] such as a maximum token length for error messages or a rule to group failures by module.
Do not use this prompt when the raw test output contains sensitive data that has not been redacted, as the prompt sends the full text to a model. It is also not a replacement for a human on-call engineer when a critical production incident requires immediate, context-rich triage; the prompt summarizes what happened, but it cannot replace the debugging intuition of an experienced developer. Finally, avoid using this prompt for real-time log tailing or for test suites that generate more than the model's context window, unless you implement a pre-processing step to chunk and aggregate the output. For high-risk release gates, always pair the generated summary with a human review step before blocking or promoting a build.
Use Case Fit
Where this prompt works and where it does not. Test report summarization is powerful but brittle when applied to the wrong data or without the right expectations.
Good Fit: Structured Test Runner Output
Use when: You have machine-parsed test results (JUnit XML, JSON test reports) with pass/fail status, duration, and error messages. The prompt excels at extracting signal from structured data, not raw console logs. Guardrail: Pre-process raw logs into a structured format with explicit fields for test name, status, duration, and failure reason before passing to the prompt.
Bad Fit: Unstructured or Incomplete Logs
Avoid when: The input is raw, interleaved console output from parallel test runs, truncated stack traces, or logs missing critical fields like expected vs. actual values. The model will hallucinate connections and miss root causes. Guardrail: Implement a pre-validation step that rejects inputs missing required fields (test name, status, failure message) and requests re-ingestion with complete data.
Required Inputs: Schema and Context
Risk: Without a defined output schema and historical context, the prompt produces inconsistent summaries that can't be compared across runs. Guardrail: Always provide [OUTPUT_SCHEMA] with explicit fields for summary statistics, failure categories, flaky test identification, and trend signals. Include [HISTORICAL_BASELINE] data for trend comparison.
Operational Risk: False Confidence in Root Cause
Risk: The model may confidently attribute failures to specific code changes or environmental factors without evidence. This is especially dangerous when the summary is used for deployment gating decisions. Guardrail: Require the prompt to distinguish between 'observed failure pattern' and 'inferred root cause.' Flag all inferred causes with [NEEDS_HUMAN_VERIFICATION] and link to specific log evidence, not just the model's reasoning.
Scale Limit: Single Report vs. Cross-Run Analysis
Risk: The prompt is designed for a single test run's report. When fed multiple runs or weeks of history, it loses precision on per-run details and produces vague trend statements. Guardrail: Use this prompt for per-run summarization only. For cross-run trend analysis, chain it: summarize each run individually, then feed those structured summaries into a separate trend analysis prompt with explicit statistical methods.
Flaky Test Detection: Requires Temporal Context
Risk: A single test run cannot reliably identify flaky tests. The model may label any failed test as 'flaky' based on error message heuristics alone. Guardrail: Provide [HISTORICAL_RUN_DATA] with pass/fail status for the last N runs per test. Instruct the prompt to only label a test as flaky when it has a history of alternating pass/fail without code changes, and to flag 'suspected flaky' separately from 'confirmed flaky.'
Copy-Ready Prompt Template
A copy-ready prompt for generating structured test report summaries from raw test run outputs.
This prompt template is designed to be pasted directly into your AI orchestration layer, test runner, or CI pipeline. It accepts raw test output—such as JUnit XML, pytest logs, or custom JSON—and produces a structured summary that engineering leads and QA managers can act on. The prompt is built to extract signal from noise: it identifies failures, flags flaky tests, notes coverage changes, and detects trend anomalies without burying the reader in passing-test logs.
textYou are a test report analyst. Your task is to read the raw test run output provided in [TEST_OUTPUT] and produce a structured summary in the exact JSON format specified in [OUTPUT_SCHEMA]. Follow these rules strictly: - Report only actionable findings. Do not list passing tests unless they are part of a trend anomaly. - If a test has failed in the last [FLAKE_WINDOW] runs, flag it as flaky and include its failure rate. - Compare coverage metrics against the baseline in [BASELINE_COVERAGE] and highlight any regression greater than [COVERAGE_THRESHOLD]%. - If [TREND_DATA] is provided, identify any statistically significant deviations in failure rate, duration, or flakiness. - For every failure, include the test name, suite, error message, and the file path if available. - If the output contains more than [MAX_FAILURES] failures, group them by error type and report only the top [MAX_FAILURES] distinct root causes. - Do not hallucinate fixes. Do not guess at root causes beyond what the error messages and stack traces provide. - If the test output is empty or unparseable, return a valid JSON object with an error key set to a description of the problem. [TEST_OUTPUT]: [PLACEHOLDER] [OUTPUT_SCHEMA]: [PLACEHOLDER] [BASELINE_COVERAGE]: [PLACEHOLDER] [TREND_DATA]: [PLACEHOLDER] [FLAKE_WINDOW]: [PLACEHOLDER] [COVERAGE_THRESHOLD]: [PLACEHOLDER] [MAX_FAILURES]: [PLACEHOLDER]
To adapt this template for your environment, replace each square-bracket placeholder with data from your test runner and CI context. The [TEST_OUTPUT] placeholder should receive the raw, unprocessed output from your test execution step—do not pre-filter or summarize it. The [OUTPUT_SCHEMA] placeholder must contain a strict JSON Schema definition that your downstream systems expect; this is your primary defense against malformed summaries. The [BASELINE_COVERAGE] and [TREND_DATA] placeholders are optional but strongly recommended for teams that want coverage regression alerts and anomaly detection. If you omit them, remove the corresponding instructions from the prompt to avoid confusing the model. The numeric placeholders [FLAKE_WINDOW], [COVERAGE_THRESHOLD], and [MAX_FAILURES] should be tuned to your team's tolerance for noise: set [MAX_FAILURES] low enough to keep summaries scannable, and set [FLAKE_WINDOW] to match your CI history retention.
Before deploying this prompt into a production pipeline, validate its output against a golden dataset of known test runs. At minimum, confirm that the model correctly identifies every failure in a run with known failures, correctly reports zero failures for a clean run, and produces valid JSON that passes your schema validator even when the input is malformed. If the summary will be surfaced in an incident response workflow or a release gate, add a human review step before the summary is treated as authoritative. A model can miss a subtle failure mode or misattribute a flaky test, and the cost of a bad summary in a high-stakes release decision justifies the review overhead.
Prompt Variables
Required inputs for the Test Report Summarization Prompt. Validate these before sending the request to prevent hallucinated summaries or missing failure signals.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TEST_RUN_OUTPUT] | Raw test run logs, XML reports, or JSON results from the test framework | JUnit XML output from | Parse check: verify valid XML/JSON. Must contain test case names and pass/fail/error/skip statuses. Reject empty payloads. |
[TEST_FRAMEWORK] | Identifier for the test framework that produced the output | pytest | Enum check: must match a supported framework (pytest, Jest, JUnit, Go test, etc.). Unknown frameworks trigger a clarification request. |
[PREVIOUS_RUN_ID] | Identifier for the prior test run to enable trend comparison | run-2024-03-15-001 | Format check: must match run ID pattern. Null allowed for first-run summaries. If provided, system must retrieve prior run data for delta calculation. |
[FLAKY_TEST_THRESHOLD] | Minimum consecutive failures before flagging a test as flaky vs. consistently broken | 3 | Range check: integer between 2 and 10. Defaults to 3 if not provided. Values below 2 produce excessive false positives. |
[COVERAGE_REPORT_PATH] | Path to coverage data file for coverage change analysis | /ci/artifacts/coverage/coverage.xml | File existence check: verify path is accessible. Null allowed. If provided, parse for line/branch coverage percentages. Reject if format is unrecognized. |
[REPOSITORY_CONTEXT] | Repository metadata for linking failures to recent changes | {"repo": "backend-api", "branch": "main", "recent_commits": ["abc123", "def456"]} | Schema check: must include repo, branch, and recent_commits array. Recent commits limited to last 20. Null allowed but reduces failure attribution accuracy. |
[OUTPUT_SCHEMA] | Target structure for the summary output | {"sections": ["executive_summary", "failure_breakdown", "flaky_tests", "coverage_delta", "trend_anomalies", "action_items"]} | Schema check: must be a valid JSON schema with required sections array. Default schema applied if null. Unknown section names trigger a warning but do not block generation. |
Implementation Harness Notes
How to wire the test report summarization prompt into an application or CI workflow with validation, retries, and human review gates.
The Test Report Summarization Prompt is designed to be called programmatically after test execution completes in a CI pipeline or test orchestration system. The prompt expects raw test output—typically JUnit XML, JSON test result files, or structured log output—as its primary input. Before calling the model, the application layer must parse the raw test results, extract the fields required by the prompt template (test suite name, total count, pass/fail/skip counts, failure details, duration, and any flaky test history), and assemble them into the [TEST_RUN_OUTPUT] placeholder. Do not pass raw, unparsed megabytes of test output directly to the model; pre-process into the structured summary fields the prompt expects to keep token usage predictable and avoid overwhelming the context window with noise.
Wire the prompt into a post-test hook in your CI system (GitHub Actions, GitLab CI, Jenkins, CircleCI) or a test result aggregator (ReportPortal, Allure, BuildPulse). After test execution, the harness should: (1) collect test result files from the test runner, (2) parse and normalize the results into the prompt's input schema, (3) call the LLM with the prompt template and structured input, (4) validate the output against the expected JSON schema (fields: summary, failures[], flaky_tests[], coverage_change, trend_anomalies[], recommended_actions[]), and (5) on validation failure, retry once with a repair prompt that includes the schema violation details. Log every invocation—input hash, model, latency, token count, output, and validation result—to your prompt observability store for debugging and trend analysis. For high-risk releases (production deployment gates, compliance-tested systems), route the generated summary to a human reviewer via a Slack notification, PR comment, or review queue before the pipeline proceeds. The human approval step should be a configurable gate: enable it for release branches, disable it for feature branch CI where latency matters more than review.
Model selection matters for this workflow. For routine CI runs where cost and speed dominate, use a fast, cheaper model (Claude Haiku, GPT-4o-mini, or a fine-tuned small model) with the structured output mode enabled. For release-candidate runs where accuracy and anomaly detection quality are critical, escalate to a more capable model (Claude Sonnet, GPT-4o) and consider providing additional context: the last three test run summaries for trend comparison, the git diff since the last passing run, and any known flaky test annotations from your test management system. Avoid calling the model when the test run is trivially green (zero failures, zero flaky tests, no coverage change); short-circuit with a pre-generated summary to save cost and latency. The harness should also enforce a timeout and token budget: if the model call exceeds 30 seconds or the output exceeds 2000 tokens, log a warning and fall back to a template-based summary generated from the parsed test results without the LLM.
Common failure modes to instrument for: the model hallucinates a failure that doesn't exist in the input (validate that every failure.test_name appears in the parsed input), the model misses a real failure (compare failures[].length against the parsed failure count and flag discrepancies), the model produces vague trend language like 'coverage slightly changed' without the actual delta (enforce numeric fields in coverage_change), or the model recommends actions that don't match the failure signatures (cross-check recommended_actions against failures[].error_type for plausibility). Build these checks into your validation layer as post-processing assertions, not as additional prompt instructions, to keep the prompt focused and the validation testable. When validation fails, log the specific check that failed and the raw model output for debugging—never silently accept a summary that fails structural or semantic validation.
Expected Output Contract
Fields, data types, and validation rules for the structured JSON response produced by the Test Report Summarization Prompt. Use this contract to parse, validate, and store the summary before surfacing it in dashboards or notifications.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
summary_id | string (UUID v4) | Must be a valid UUID v4 generated by the model. Reject on parse failure. | |
run_identifier | string | Must match the [RUN_IDENTIFIER] provided in the prompt input. Reject if missing or mismatched. | |
overall_status | enum: passed | failed | errored | aborted | Must be one of the four allowed enum values. Reject on unknown value. | |
total_tests | integer >= 0 | Must be a non-negative integer. Reject if negative or non-integer. | |
passed_tests | integer >= 0 | Must be <= total_tests. Reject if greater than total_tests. | |
failed_tests | integer >= 0 | Must equal total_tests - passed_tests - skipped_tests - errored_tests. Reject on arithmetic mismatch. | |
skipped_tests | integer >= 0 | Must be a non-negative integer. Null not allowed; default to 0 if no skips reported. | |
errored_tests | integer >= 0 | Must be a non-negative integer. Null not allowed; default to 0 if no errors reported. | |
flaky_test_ids | array of strings | Each element must match a test_id present in the failed_tests_details array. Reject orphan flaky IDs. | |
coverage_pct | number (0.0-100.0) | Must be a float between 0.0 and 100.0 inclusive. Reject if outside range. Null allowed when coverage data unavailable. | |
coverage_delta_pct | number | Must be a signed float representing change from prior run. Null allowed when baseline unavailable. Reject if present without coverage_pct. | |
failed_tests_details | array of objects | Must be present even if empty. Each object must contain test_id (string, required), failure_message (string, required), and file_path (string, required). Reject if any required sub-field is missing. | |
anomalies | array of objects | Each object must contain anomaly_type (enum: duration_spike | new_failure | flaky_recurrence | coverage_drop, required) and description (string, required). Reject on unknown anomaly_type. | |
recommended_actions | array of strings | Each string must be non-empty and <= 500 characters. Reject empty strings. Null allowed when no actions recommended. | |
generated_at | string (ISO 8601 UTC) | Must parse as a valid ISO 8601 datetime in UTC. Reject on parse failure or non-UTC offset. |
Common Failure Modes
Test report summarization fails in predictable ways when the prompt cannot distinguish signal from noise. These are the most common failure modes and how to guard against them before they reach production.
Hallucinated Failure Counts
What to watch: The model reports specific numbers of failures, passes, or skips that don't match the raw test output. This happens when the prompt asks for counts without instructing the model to extract them verbatim from the input. Guardrail: Require the model to quote exact counts from the source and include a counts_verified boolean field. Run a post-processing diff between extracted counts and raw output.
Flaky Test Misclassification
What to watch: The model treats every intermittent failure as a new regression, flooding the summary with false positives. Without historical context, the model cannot distinguish a known flaky test from a genuine new failure. Guardrail: Provide a flaky-test allowlist as part of the input context. Instruct the model to label known flaky tests separately and suppress them from the regression section unless the failure signature changed.
Trend Fabrication Without Baseline
What to watch: The model invents trend language like 'coverage is declining' or 'failure rate is increasing' when only a single run is provided. It confuses narrative fluency with data-backed analysis. Guardrail: Explicitly require a previous_run input for any trend claim. If absent, instruct the model to output trend_analysis: "insufficient_data" and skip all comparative language.
Actionable Signal Buried in Noise
What to watch: The summary is technically accurate but buries the one critical new failure inside a wall of passing tests and known flakes. The reader misses the signal that requires immediate action. Guardrail: Structure the output so new, unique failures appear first with severity labels. Use a dedicated requires_immediate_action array and validate that it contains only first-occurrence failures not on the flaky allowlist.
Coverage Percentage Drift
What to watch: The model reports coverage percentages that don't match the input, often rounding or averaging incorrectly across modules. This is especially common when coverage data spans multiple formats or tools. Guardrail: Require per-module coverage extraction with exact precision from the source. Add a schema constraint that coverage values must match a regex pattern from the raw report. Flag any synthesized or rounded values in post-validation.
Root Cause Overreach
What to watch: The model confidently attributes a test failure to a specific commit, developer, or code path without evidence in the input. It treats correlation patterns as causal explanations. Guardrail: Restrict the summary to observed facts from the test output. For any root cause suggestion, require an explicit evidence_source pointer to a stack trace, log line, or diff. If no evidence exists, output root_cause: "undetermined" and flag for human triage.
Evaluation Rubric
Criteria for evaluating whether the test report summary is accurate, actionable, and safe to surface to engineering leads before shipping the prompt to production.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Failure extraction completeness | All test failures present in [RAW_TEST_OUTPUT] appear in the summary with correct test names and error messages | Summary omits a failing test or truncates error message to the point of losing diagnostic value | Diff extracted failure list against ground-truth failure set from [RAW_TEST_OUTPUT]; require 100% recall |
Flaky test identification | Tests that appear in both pass and fail counts across multiple runs in [RAW_TEST_OUTPUT] are flagged as flaky with run-count evidence | Flaky test is reported as a hard failure or omitted entirely; no run-count evidence provided | Inject known flaky pattern into [RAW_TEST_OUTPUT]; verify summary contains flaky label and run counts |
Coverage change accuracy | Coverage delta matches [RAW_TEST_OUTPUT] coverage section within ±0.5 percentage points; direction of change is correct | Coverage change is reported with wrong sign, magnitude off by more than 2 points, or fabricated when no coverage data exists | Parse coverage section from [RAW_TEST_OUTPUT]; compare numeric values and sign to summary output |
Trend anomaly detection | Summary flags run duration or failure count anomalies when values exceed 2 standard deviations from [HISTORICAL_BASELINE] | Anomaly is reported without baseline comparison, or clear anomaly is missed entirely | Provide [RAW_TEST_OUTPUT] with injected duration spike; verify summary includes anomaly flag and baseline reference |
Actionable signal ranking | Failures are ordered by impact: new failures first, then regressions, then pre-existing; each has a suggested owner or log reference | All failures listed in arbitrary order with no prioritization or owner hints | Review failure ordering against known priority rules; check that each failure row has a non-empty owner or log pointer |
Hallucination absence | No test name, file path, or metric appears in summary that is not present in [RAW_TEST_OUTPUT] | Summary invents a test name, coverage file, or metric value not found in input | Run summary through exact-match check against [RAW_TEST_OUTPUT] token set; flag any novel identifiers |
Uncertainty expression | When [RAW_TEST_OUTPUT] is truncated, ambiguous, or missing a section, summary states what is unknown rather than guessing | Summary fills gaps with plausible but unsupported values or omits uncertainty qualifiers | Provide [RAW_TEST_OUTPUT] with missing coverage section; verify summary says coverage unavailable rather than fabricating a number |
Output schema compliance | Summary output is valid JSON matching [OUTPUT_SCHEMA] with all required fields present and correctly typed | Output is missing required fields, contains type mismatches, or is not parseable JSON | Validate output against [OUTPUT_SCHEMA] with JSON Schema validator; reject on any schema violation |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with lighter validation. Focus on getting the summary structure right before adding strict schema enforcement. Accept markdown output and parse it loosely.
Prompt modification
- Remove the
[OUTPUT_SCHEMA]block and replace with:Return a markdown report with sections for Failures, Flaky Tests, Coverage Changes, and Anomalies. - Drop the
[CONSTRAINTS]around exact field types and enum values. - Add:
If you are unsure about a trend, note it as "Uncertain" rather than guessing.
Watch for
- Missing schema checks causing downstream parsing failures
- Overly broad instructions producing narrative prose instead of structured findings
- Hallucinated test names when the input log is truncated or ambiguous

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us