Share an Extent Report

Extent's Spark report is the nicest artifact in the Java QA toolchain and the most stubbornly local. It's written to target/, which the next mvn clean deletes, on the machine or agent that ran the suite.

So it gets zipped, or screenshotted, or attached to a Jira ticket at 40 MB.

Publish the folder, not the file

ExtentSparkReporter spark = new ExtentSparkReporter("target/spark/Spark.html");
ExtentReports extent = new ExtentReports();
extent.attachReporter(spark);

Drag target/spark/ (or a zip of it) into the app:

  • Spark.html becomes the report body.
  • Screenshots attached with addScreenCaptureFromPath upload alongside and their relative references are rewritten to the uploaded copies — which is exactly what emailing the single file destroys.
  • Scripts run inside a sandboxed iframe (allow-scripts, no allow-same-origin), so the dashboard, the filters and the test tree all work.

If you'd rather ship one self-contained file, two switches help: spark.config().setOfflineMode(true) bundles Spark's own CSS and JS instead of loading them from a CDN, and addScreenCaptureFromBase64String inlines the screenshots.

From CI

mvn -B test || true   # keep going: the failing run is the one worth publishing

curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html target/spark/Spark.html \
        --arg title "Regression — $GIT_COMMIT" '{title: $title, html: $html}')"

Run the publish step with if: always() (GitHub Actions), when: always (GitLab, CircleCI) or post { always { … } } (Jenkins). PATCHing one report id keeps a single URL per suite and appends a revision per run, so "did this pass last night?" is a diff rather than a hunt through expired artifacts.

Attaching the screenshots as assets is the REST API assets call; the drag-and-drop path does it for you.

What review adds

  • Anchored threads on the failing test, next to its screenshot — see commenting on HTML.
  • Revisions, so a flaky test's history is visible instead of remembered.
  • Access per report — private, team, domain-gated or named reviewers. See the sharing model.

Limits

  • Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total. Screenshot-heavy suites are the ones to watch — Base64 captures count against the 5 MB entry file, path captures against the asset budget.
  • 60 requests/minute per token.

Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision history.

Publish a test report →

Related