Skip to main content

Next step: AI triage of your test results

Why This Matters

Lesson 40 ended with a verdict for every failure: product, test, environment or flaky. That step takes the most time on a bad morning, and it is the step where an AI assistant can help most. It can only help if it gets the right evidence, and you now produce exactly that: a JSON report with every error, every attempt and the path of every trace. This lesson shows what AI triage adds, where it goes wrong, and where you can learn to build it properly.

What you will learn

  • What evidence an assistant needs to give a useful verdict
  • A first triage prompt you can use today, with any AI assistant
  • What a human still decides, and where to go next

Evidence first

An assistant that only sees “15 tests failed” will guess. Give it what you would look at yourself:

EvidenceWhere it comes from
Which tests failed, in which projects, how many attemptsresults.json: status, projectName, results
The error, with Expected and Receivedresults[].errors[].message
The failing lineresults[].errors[].location, plus the test file itself
Did it pass on a retry?test status flaky
The run as a whole: one failure or forty?stats, and the summary table of lesson 40
What the page didthe trace: network, console, the snapshot before the failing step

The first five are text, and you already have them. The summary table from lesson 40 is a compact starting point. The trace is the evidence that settles most disputes, and it is the hardest one to hand over: an assistant needs a tool to open it, or you need to copy out what you saw.

A first triage prompt

Copy the summary table of a red run, add the test file, and ask for a verdict per row with the evidence behind it:

You triage failed Playwright tests. For every row in the table below, give:
- verdict: product bug, test bug, environment, flaky, or unknown
- evidence: the exact part of the error or the code that supports the verdict
- next step: one concrete action

Rules:
- Say "unknown" when the evidence does not settle it. Do not guess.
- A failure in all browsers is not a browser problem.
- Only call something a product bug if the error shows the application doing something wrong,
  not just something slow or missing.

The summary table:
<paste the table from the run page>

The test file:
<paste tests/module-3/debugging.spec.ts>

Three things make this prompt work:

  1. A fixed set of verdicts. Free text produces essays; a fixed list produces answers you can compare and count.
  2. “Unknown” is allowed. Without it, an assistant picks the most likely-sounding answer, also when there is not enough evidence. A wrong verdict is worse than no verdict.
  3. The cost of a mistake is in the rules. A false “product bug” sends a developer on a hunt and damages trust in the suite. That is why the prompt sets the strictest bar for exactly that verdict.

What a human still decides

An assistant proposes; you decide. Keep three things for yourself:

  • Filing a bug. A verdict is a hypothesis until someone has looked at the trace.
  • Changing an expectation. “The test expects $72.99 and the page shows $72.59” is a fact. Which one is right is a business question: was the price changed on purpose?
  • Anything that needs context the report does not contain: a deploy that happened at 03:00, a known outage, a feature behind a flag.

Also watch what you paste. Reports from a real application can contain customer data in screenshots, tokens in network logs, or internal URLs. The practice site has none of that; your own application may.

Where to go next

Pasting a table into a chat is a start. A real triage assistant reads the JSON report itself, opens the traces through a tool, answers in a fixed structure, is measured against a set of known failures, and runs in your pipeline after every red build. Building that is a course of its own:

Both start where this course ends: with a suite that runs in CI and reports that a machine can read.

Exercise

Take the summary table of the latest red run on exercise/debugging (lesson 40) and the test file tests/module-3/debugging.spec.ts from that branch. Use the prompt above with an AI assistant of your choice, and compare its verdicts with yours from lesson 40.

  1. On which tests do you agree?
  2. Where do you disagree, and who is right?
  3. Run the prompt again, but without the test file. What changes?
Show suggested answer

With the test file, an assistant usually gets the four test bugs right: the strict-mode error names the five matching buttons, the missing test id shows up as a timeout on getByTestId("search-box"), the textContent read is visible in the code, and the price mismatch is plain in Expected and Received.

The slow-backend test is where verdicts differ. From the error alone (a product did not become visible within 5000 ms), “environment” and “product bug: the shop is too slow” both sound reasonable. The test file settles it: the test itself delays the request by six seconds with page.route. An assistant that reads the code finds that; one that only reads the error cannot.

Without the test file, expect more “unknown” answers, if the prompt allows them. Expect more confident wrong ones if it does not. That is the point of the exercise: the quality of AI triage depends less on the model than on the evidence you give it and on the room you leave it to say it does not know.