Q24 of 40 · Karate

Walk through how Karate generates HTML reports and what's actionable in them.

KarateMidkaratereportinghtml-reportsci-cddebugging

Short answer

Short answer: Karate writes an HTML report to target/karate-reports after each run. The summary index shows total pass/fail counts, timing, and thread layout. Each feature has a step-by-step pass/fail breakdown with expandable HTTP request/response payloads for every API call — useful for diagnosing exactly what was sent and received.

Detail

Report files:

  • target/karate-reports/karate-summary.html — suite-level index
  • target/karate-reports/<feature-name>.html — individual feature report
  • target/karate-reports/karate-timeline.html — parallel execution timeline

Karate summary — actionable fields:

  • Pass/fail counts and percentages
  • Total duration and thread count
  • Feature-level pass/fail — click through to the failing feature's report

Feature report — most useful for debugging:

  • Each step shown with pass ✓ / fail ✗ icon
  • Failing step highlighted in red with the actual vs expected diff
  • Expandable HTTP request/response payloads for every method GET/POST step — shows exact URL, headers, body
  • * print output appears inline in the step where it was called

Timeline report — useful for parallel execution analysis:

  • Shows which feature ran on which thread and when
  • Identifies long-running features (candidates for splitting)
  • Reveals thread imbalance (some threads idle while others are overloaded)

CI integration: the JUnit XML files (.outputJunitXml(true)) allow most CI systems to parse test results. The HTML reports are artefacts to publish separately (Jenkins HTML Publisher, GitHub Actions upload-artifact).

// EXAMPLE

// Enable all report types in the runner
Results results = Runner
    .path("classpath:features")
    .outputJunitXml(true)            // for CI test result parsing
    .outputCucumberJson(true)        // for Cucumber-based report tools (Allure, ReportPortal)
    .parallel(4);

// target/karate-reports/ contains:
// - karate-summary.html         ← open this in browser for full suite overview
// - karate-timeline.html        ← parallel thread gantt chart
// - features/users/*.html       ← per-feature HTML with HTTP payloads
// - *.xml                       ← JUnit XML for CI

// GitHub Actions — publish HTML report as artifact
// steps:
//   - uses: actions/upload-artifact@v4
//     if: always()       # publish even on failure
//     with:
//       name: karate-test-report
//       path: target/karate-reports/

// WHAT INTERVIEWERS LOOK FOR

Knowing the report location (target/karate-reports, not surefire-reports), the three report types (summary, feature, timeline), and what the timeline reveals about parallel execution efficiency. Publishing reports in CI with 'if: always()' is a practical detail.

// COMMON PITFALL

Not publishing the HTML reports in CI — when a test fails in a pipeline, the HTML report with the HTTP payloads is the fastest way to diagnose it, but it's only useful if it's accessible as a CI artifact.