Karate's built-in HTML report is excellent for local debugging. For CI dashboards, historical trend data, and reports shared with stakeholders who don't run tests themselves, you want something richer: a report that tracks pass rates across runs, highlights new failures vs recurring ones, and presents results in a polished format. Karate generates Cucumber-compatible JSON automatically, and that JSON feeds directly into the ecosystem of third-party reporting tools that teams have built around Cucumber.
The Cucumber JSON output — the integration bridge
Every tool in this lesson consumes the same JSON file that Karate generates. Enable it with one flag in the runner:
Results results = Runner
.path("classpath:")
.outputCucumberJson(true)
.parallel(4);After the run, target/karate-reports/ contains one .json file per feature file. Each file follows the Cucumber JSON format — the same schema that tools like Cluecumber, Allure, and the Masterthought Cucumber Reports plugin have consumed for years. Add this flag once; every integration works from the same output.
maven-cucumber-reporting — rich HTML with trends
The Masterthought maven-cucumber-reporting plugin reads the Cucumber JSON and produces a polished multi-page HTML report with feature breakdowns, tag analysis, step timing charts, and a failure summary. Add it to pom.xml:
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>5.8.1</version>
<executions>
<execution>
<id>generate-reports</id>
<phase>verify</phase>
<goals><goal>generate</goal></goals>
<configuration>
<projectName>TeamHub API Tests</projectName>
<outputDirectory>${project.build.directory}/cucumber-html-reports</outputDirectory>
<jsonFiles>
<param>${project.build.directory}/karate-reports/*.json</param>
</jsonFiles>
</configuration>
</execution>
</executions>
</plugin>Run mvn verify instead of mvn test — the verify phase runs after test, so the Karate JSON is ready when the plugin executes. The report appears at target/cucumber-html-reports/overview-features.html.
The Masterthought report shows scenario pass rates, feature-level breakdowns, tag-based filtering, and step-level timing. Unlike Karate's built-in report, it doesn't show the raw HTTP request/response bodies — use Karate's report for debugging, use Masterthought for stakeholder communication.
Allure integration
Allure is a widely-used reporting tool that integrates with most Java test frameworks. The cleanest Karate + Allure path is via the Cucumber JSON:
- Run Karate with
.outputCucumberJson(true). - Use the
allure-commandlinetool to generate an Allure report from the Cucumber JSON. - Publish the report to Allure's hosting or upload it as a CI artifact.
# Install Allure CLI (once)
brew install allure
# Generate Allure report from Cucumber JSON
allure generate target/karate-reports/ --clean -o target/allure-report
allure open target/allure-reportAllure's distinctive feature over Masterthought is its trend data: run it against a history of Cucumber JSON outputs and it shows pass-rate trends, flakiness scores, and test duration trends over time. This requires storing the Allure history directory between CI runs — typically done by uploading and downloading it as a CI artifact.
JUnit XML — automatic CI integration
Karate generates JUnit-compatible XML at target/surefire-reports/ alongside the HTML report. Jenkins's JUnit publisher and GitHub Actions's test reporting both parse this format automatically, without any plugin configuration:
- GitHub Actions: the
junit-reporteraction or the default PR check annotations pick up Surefire XML and display pass/fail counts directly on the pull request. - Jenkins: the
junitpost-build step attarget/surefire-reports/*.xmlshows test trends on the pipeline dashboard.
No configuration in the Karate runner is needed for JUnit XML — it's generated by default whenever Karate runs through a JUnit 5 runner class.
The reporting pipeline
Choosing the right tool
Use Karate's built-in report when: debugging a specific failed scenario, reviewing the raw HTTP conversation, doing local development.
Use maven-cucumber-reporting when: generating a shareable report for stakeholders, running nightly suites where you want a clean per-run summary with feature-level breakdowns.
Use Allure when: tracking trends across many runs, identifying flaky tests over time, integrating with an existing Allure-based reporting setup.
Use JUnit XML when: you need CI-native annotations (PR pass/fail checks, Jenkins test history) without setting up an external tool.
Most teams use Karate's built-in report plus JUnit XML (automatic), and add maven-cucumber-reporting or Allure once the suite is mature enough that trend data becomes useful.
⚠️ Common mistakes
- Running
mvn testinstead ofmvn verifywith the Masterthought plugin. The plugin is bound to theverifyphase, which runs aftertest. Runningmvn testexecutes Karate but skips the plugin — no Masterthought report appears. Usemvn verifyor add-Dskip.verify=falsein CI scripts that already usemvn test. - Pointing the plugin's
<jsonFiles>at the wrong path. The glob${project.build.directory}/karate-reports/*.jsonworks when Karate generates files there. If you've customised the Karate output directory, update the path to match. A missing glob pattern makes the plugin generate an empty report without an error. - Generating Allure reports without persisting history between CI runs. Allure trend data requires the history from the previous run. If each CI run starts fresh, Allure generates a single-run report with no trend charts. Store the
target/allure-report/history/directory as a CI artifact, download it before the next run, and copy it intotarget/allure-report/history/before generating — this is the standard pattern for keeping Allure trends across runs.
🎯 Practice task
Wire up one third-party report tool end to end. 30–40 minutes.
- Add
.outputCucumberJson(true)to yourParallelRunner. Runmvn test. Confirm.jsonfiles appear intarget/karate-reports/alongside the.htmlfiles. - Add the
maven-cucumber-reportingplugin topom.xmlwith the configuration from this lesson. Runmvn verify. Opentarget/cucumber-html-reports/overview-features.html. Compare it to Karate's built-in report — note what the Masterthought report adds (tag analysis, step charts) and what it lacks (request/response bodies). - Install the Allure CLI (
brew install allureor download from the Allure GitHub releases). Runallure generate target/karate-reports/ -o target/allure-report. Open withallure open target/allure-report. Read the Overview page. - Force two scenarios to fail. Run again. Compare the failure presentation in Karate's HTML, Masterthought's report, and Allure. Note which format is easiest to diagnose the root cause from.
- In GitHub Actions (or write the YAML even if you don't have a live repo), add a step that uses
actions/upload-artifactto save bothtarget/karate-reports/andtarget/cucumber-html-reports/. Useif: always()so they upload even on failure. - Stretch: read the Masterthought plugin's GitHub README and find the
classificationsconfiguration option. Add a classification that records the environment name and Java version in the report header. This is useful when the same report is shared across staging and production runs.
Next lesson: running Karate in CI/CD pipelines — complete GitHub Actions and Jenkins configurations, environment switching, and scheduling.