Skip to content

HTML report, payload snapshots and test source locations - #1

Merged
stromcom merged 1 commit into
masterfrom
feature/html-report
Aug 3, 2026
Merged

HTML report, payload snapshots and test source locations#1
stromcom merged 1 commit into
masterfrom
feature/html-report

Conversation

@stromcom

@stromcom stromcom commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Changes since v0.4.0

HTML report — --output-html=FILE

vendor/bin/http-smoke staging --output-html=build/smoke.html

One self-contained file: no CDN, no assets, no server. Open it in a browser or
publish it as a CI artefact. It embeds the canonical JSON and renders it
client-side:

  • summary cards + pass/fail/skip ratio bar, environment / duration / concurrency meta,
  • groups with per-group tallies; failed tests are expanded by default,
  • per-test detail: method, URL, HTTP code, duration, attempts (total time incl. retries),
    all failure messages verbatim, skip reasons,
  • chain context for session tests — every preceding step of the session
    (method, status, label, URL, duration) with the failing step highlighted,
  • filters: full-text search (label / URL / failure message / payload / path),
    status, group, definition file, retried-only, sessions-only, plus
    expand/collapse all and “show payloads”.

Dark mode follows the OS setting. Test details render lazily on first open, so
large suites stay fast. The layout lives in
src/Reporting/templates/report.htmlHtmlReporter only injects the JSON, so
the same template can later back a standalone viewer for any report.json.

Payload snapshots — what actually went over the wire

Each test now carries the request as sent and the response as received:
headers (including the implicit Content-Type), query parameters, body in its
wire encoding, plus a ready-to-run cURL reproduction in the HTML report.
JSON bodies are pretty-printed for display.

Request owns the encoding (encodedBody(), effectiveHeaders(),
bodyEncoding()) and CurlMultiClient uses those same methods — a report cannot
drift from what was really sent.

Secrets: Authorization, Proxy-Authorization, Cookie, Set-Cookie,
X-Api-Key, X-Auth-Token, X-Csrf-Token are replaced with «redacted»,
bodies are truncated at 16 kB (original size reported) and non-UTF-8 bodies are
reported as size only. Both the JSON and HTML artefacts now contain request and
response bodies — treat them accordingly in CI.

vendor/bin/http-smoke prod --output-html=report.html --no-payloads
vendor/bin/http-smoke prod --output-html=report.html --payload-limit=65536
$config->includePayloads = false;
$config->payloadMaxBytes = 65536;
$config->redactedHeaders = ['authorization', 'x-tenant-secret'];

Markdown and GitHub step-summary reports are unaffected — they build their JSON
with payloads off.

Test source locations — find the failing test instantly

Every test records the definition file and line of its get() / post() / …
call (Definition\SourceLocation, captured from the backtrace at build time):

  • HTML report: …/api/users.php:24 badge in the test row, a “Defined in” block
    in the detail, and a filter by definition file,
  • console: a dim at tests/SmokeHttp/api/users.php:24 line under each failure,
  • Markdown / GitHub summary: `file:line` in the failure details,
  • JSON: tests[].source with file (relative to meta.base_path),
    absolute_path and line.

JSON report schema v3

JsonReporter::SCHEMA_VERSION is now 3:

  • meta.base_path — project root, used to shorten source paths,
  • meta.payloads — whether payloads are included in this artefact,
  • tests[].source — definition file + line,
  • tests[].request / tests[].response — payload snapshots (null when
    payloads are off, for skipped tests, or when no request was sent).

Consumers of v2 keep working for every previously existing field — v3 only adds
keys.

New CLI flags

--output-html=FILE      Write standalone HTML report to file
--no-payloads           Omit request/response payloads from JSON + HTML reports
--payload-limit=BYTES   Truncate each payload body (default: 16384)

New config options (smoke.config.php)

$config->htmlOutputPath  = __DIR__ . '/build/smoke.html';
$config->includePayloads = true;
$config->payloadMaxBytes = 16384;
$config->redactedHeaders = ['authorization', 'cookie', ''];

HtmlReporter (--output-html=FILE) renders one run as a single self-contained
HTML file: summary cards, per-group tallies, expandable tests, failure details,
request/response payloads with a cURL reproduction, session chain context and
live filters. The canonical JSON is embedded and rendered client-side by the
template's JS, so the same template can later back a standalone JSON viewer.

JSON schema bumped to v3:
- tests[].request / tests[].response — payloads as actually sent/received,
  produced by Reporting\Support\PayloadFormatter (sensitive headers redacted,
  bodies truncated at 16 kB, binary bodies reported as size only)
- tests[].source — definition file + line of each test
- meta.base_path, meta.payloads

Request now owns the wire encoding (encodedBody(), effectiveHeaders(),
bodyEncoding()) and CurlMultiClient uses those methods, so reports cannot drift
from what was sent. Runner threads the sent Request into Result.

Definition\SourceLocation captures the file+line of each get()/post()/... call,
surfaced in the HTML report (badge, "Defined in" block, file filter), under
console failures (at file:line) and in the Markdown failure details.

New CLI flags: --output-html=FILE, --no-payloads, --payload-limit=BYTES
New config: htmlOutputPath, includePayloads, payloadMaxBytes, redactedHeaders,
projectRoot
@stromcom
stromcom merged commit 4b96cb1 into master Aug 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant