Reference

JSON Report Format

The structured JSON output from tarn run --format json with versioned schema for CI and agent consumption.

Top-level structure

{
  "schema_version": 1,
  "summary": {
    "status": "PASSED" | "FAILED",
    "total": 10,
    "passed": 9,
    "failed": 1
  },
  "files": [...]
}
Field Type Description
schema_versionintegerReport schema version (currently 1)
summary.statusstring"PASSED" or "FAILED"
summary.totalintegerTotal test count
summary.passedintegerPassed test count
summary.failedintegerFailed test count
filesarrayArray of file results

File object

Field Type Description
filestringPath to the test file
testsarrayArray of test results

Test object

Field Type Description
namestringTest name (or "flat" for unnamed steps)
statusstring"PASSED" or "FAILED"
stepsarrayArray of step results

Step object

{
  "name": "Create user",
  "status": "PASSED" | "FAILED",
  "failure_category": "assertion_failed",
  "assertions": {
    "failures": [{
      "assertion": "status",
      "expected": "201",
      "actual": "400",
      "message": "Expected status 201, got 400"
    }]
  },
  "request": { "method": "POST", "url": "..." },
  "response": { "status": 400, "body": {...} }
}
Field Type Description
namestringStep name
statusstring"PASSED" or "FAILED"
failure_categorystringCategory of failure (see Failure Categories)
error_codestringStable machine-readable subtype for routing
remediation_hintsarrayNext-step guidance hints
assertions.failuresarrayArray of assertion failure details
assertions.failures[].assertionstringThe assertion that failed
assertions.failures[].expectedstringExpected value
assertions.failures[].actualstringActual value
assertions.failures[].messagestringHuman-readable failure description
requestobjectRequest details (included for failed executed steps)
responseobject|nullResponse details (omitted when no HTTP response exists)

When request/response are included

  • request is included for failed executed steps
  • response is included when an HTTP response was received
  • response is null for connection errors, DNS failures, TLS errors
  • Non-JSON responses are preserved as JSON strings

JSON output modes

Mode Flag Description
Verbose--json-mode verboseFull assertion details, all passed/failed assertions included
Compact--json-mode compactDrops passed assertion details, truncates response bodies (~200 chars)
LLM--format llmLLM-friendly grep-friendly text (auto on pipe; no ANSI when piped)
Agent--agentCompact root-cause-first AgentReport JSON for MCP/automation

Example failed report

{
  "schema_version": 1,
  "summary": { "status": "FAILED", "total": 1, "passed": 0, "failed": 1 },
  "files": [{
    "file": "tests/users.tarn.yaml",
    "tests": [{
      "name": "User API",
      "status": "FAILED",
      "steps": [{
        "name": "Create user",
        "status": "FAILED",
        "failure_category": "assertion_failed",
        "assertions": {
          "failures": [{
            "assertion": "body.$.name",
            "expected": "Jane Doe",
            "actual": "Jane Smith",
            "message": "Body assertion failed for $.name: expected 'Jane Doe', got 'Jane Smith'"
          }]
        },
        "request": { "method": "POST", "url": "http://api.example.com/users" },
        "response": { "status": 201, "body": { "name": "Jane Smith", "id": "abc123" } }
      }]
    }]
  }]
}

How CI / agents parse the report

  1. Check summary.status: "PASSED" means all tests passed
  2. Iterate files[].tests[].steps[]
  3. Check failure_category first (not the assertion message)
  4. Read response.body to fix assertions against real payload
  5. Use request.url to check for unresolved {{ ... }} interpolation