{
  "id": 22000653,
  "title": "Giving a coding agent test results it can act on: JUnit XML, go test -json and a short failure summary",
  "url": "https://urgent.news/2026/11/26/giving-a-coding-agent-test-results-it-can-act-on-junit-xml-go-test",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-26T16:09:29.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/sandscale/giving-a-coding-agent-test-results-it-can-act-on-junit-xml-go-test-json-and-a-short-failure-1pl6"
  },
  "original_language": "en",
  "account": "Coding agents typically spend a significant portion of their time iterating on code changes, running tests, and reviewing the results. The efficiency of this loop is heavily influenced by how the results are presented. A simple exit code of 1 indicates that a test has failed, but it doesn't provide any details about the issue. On the other hand, a full test log contains all the information, but it comes at the cost of using up tokens and attention. The crucial metric that matters is the information about the failing test, which is often buried within the log.\n\nTest runners are capable of generating structured reports that list each test, its status, and for failing tests, a message and a stack trace. However, these reports are not always easily accessible to the coding agents. This post demonstrates how to extract these reports from a sandbox and convert them into a tool that is tailored for the model. The tool provides essential counts, the first few failures, and a clear indication if the run was incomplete. To achieve this, the testing runners should be asked for a report.\n\nThree popular testing frameworks, each producing a report alongside their normal output, are pytest, Vitest, and go test. pytest generates a JUnit XML report using the `--junitxml=report.xml` flag, while Vitest uses the `--reporter=junit --outputFile=report.xml` flag. Similarly, go test can produce a JSON event per line on the standard output by running `go test -json`. Despite having different approaches, all these formats can be converted into a standardized JUnit XML format. This format is considered the de facto standard in the ecosystem because it allows a consistent representation of tests, test cases, and their results. Each test case within a test suite can have a `failure` or `error` child element, which includes a `message` attribute and the trace as plain text. Skipped cases, on the other hand, have a `skipped` child element. Go's format, however, is a stream of events rather than a structured document. Each event includes an action such as `run`, `output`, `pass`, `fail`, or `skip`, along with the specific package and test name. The test output, which includes the failure details, is delivered as a series of output events preceding the `fail` event. The parsing of these reports into a summary involves reading either the JUnit XML or the Go format and returning a consistent structure. This summary includes the total number of tests, the number of failed tests, the number of skipped tests, a list of the first few failures (capped at five), and the total number of failures that are omitted due to the limited view.",
  "summary": "Most coding agents spend a large share of their turns in one loop: change code, run the tests, read the result, change code again. The quality of that loop depends on what \"read the result\" means. An exit code of 1 tells the model something failed and nothing about what. The full log tells it everything, at a cost in tokens and attention, and the one assertion that matters is somewhere in the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}