Skip to content

Allure reporter support#852

Open
DavertMik wants to merge 18 commits into
2.xfrom
feat/allure-support
Open

Allure reporter support#852
DavertMik wants to merge 18 commits into
2.xfrom
feat/allure-support

Conversation

@DavertMik

Copy link
Copy Markdown
Contributor

Summary

Adds an Allure results reporter (npx @testomatio/reporter allure <pattern>) that parses Allure JSON result/container files and uploads them to Testomat.io, mirroring the existing XML (report-xml) reader.

This PR also brings the Allure reader in line with the new 2.x batching strategy (the BATCH_MODE enum: auto / manual / disabled) so XML and Allure upload identically.

What's included

  • src/allureReader.js — parse Allure *-result.json / *-container.json, dedupe retries by historyId, map statuses, extract suites/labels/links/attachments, fetch source code, upload artifacts.
  • allure CLI command in src/bin/cli.js.
  • Kotlin junit adapter (src/junit-adapter/kotlin.js) + factory wiring.
  • Docs: docs/allure.md.
  • Tests: tests/adapter/allure.test.js, tests/adapter/allure-integration.test.js.

Batching: same principles as XML, no double-send

Resolved the in-progress 2.x merge and aligned batching:

  • Extracted XML's proven size-limited chunking (≤1MB per batch) into a shared splitTestsIntoChunks helper in src/utils/pipe_utils.js; both XmlReader and AllureReader now use it (single source of truth).
  • AllureReader uploads in BATCH_MODE.MANUAL: addTest only buffers, sync() flushes one batch request per chunk. There is no setInterval auto-upload, and #batchUpload drains the buffer with splice(0), so each test is sent exactly once.
  • Dropped the earlier Allure-only bulk flag from #batchUpload/sync(). Since sync() is shared by both readers, keeping bulk:true there would have regressed the XML upload path introduced in 2.x.

Verification

  • npm run build ✅   npm run lint
  • Full unit suite: 475 passing (incl. xmlReader_chunking and testomatio_pipe batch-mode tests).
  • Two failures in allure-integration.test.js are pre-existing (missing sample_allure/android fixture + an unrelated suite-hierarchy assertion) — confirmed identical pass/fail counts on the pre-merge code; untouched by these changes.

🤖 Generated with Claude Code

DavertMik and others added 18 commits January 15, 2026 07:30
- Update package-lock.json to sync with package.json
- Revert build/scripts/edit-js-files.js to working version
Fixes CI build failure caused by optional peer dependencies
(detox, @wix-pilot) that were causing npm ci to fail.
Allure results inherently contain steps and stack traces for all tests,
so TESTOMATIO_STACK_PASSED and TESTOMATIO_STEPS_PASSED are now enabled
by default in AllureReader to prevent silently stripping this data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accept upstream changes: log utility, simplified batch enabled logic,
and command guard in CLI filter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
XML and Allure readers use sync() to flush tests, so the server
can distinguish bulk imports from normal test runner batch uploads.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts and align Allure batching with the new 2.x strategy.

- cli.js: keep AllureReader import alongside 2.x's DEBUG_FILE/BATCH_MODE
- testomatio.js: adopt 2.x BATCH_MODE.DISABLED check in #batchUpload and
  drop the allure-only `bulk` flag. sync() is shared by XML and Allure, so
  keeping `bulk:true` there would have regressed XML upload behavior.
- Extract the proven XML chunking (≤1MB per batch) into a shared
  splitTestsIntoChunks helper in pipe_utils; use it from both readers.
- AllureReader now uploads exactly like XmlReader: BATCH_MODE.MANUAL,
  buffer per chunk, flush one batch per chunk via sync(). No setInterval
  auto-upload, so every test is sent exactly once (no double-send).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…IntoChunks util

- pipe_utils_test.js: direct unit tests for splitTestsIntoChunks — 1000-test
  suite splits into multiple chunks, count/order preserved, each chunk under
  the 1MB limit, oversized singletons isolated, custom maxSizeBytes honored.
- allure_chunking_test.js: AllureReader.uploadData with 1000 tests splits into
  multiple batches, uploads every test exactly once (no loss / no double-send),
  uses sequential batch indices, finishes the run once. Mirrors the existing
  XmlReader chunking test. Saves/restores TESTOMATIO_STACK_PASSED/STEPS_PASSED
  so AllureReader's env side effects don't leak into sibling unit suites.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Allure `links` array (which carries @TMslinK values) was ignored
entirely, and test_id was only ever derived from source-code annotations.
Reports without source access uploaded with no test_id, so Testomat.io
created new cases on every run instead of matching — e.g. 1556 tests
producing 1767 duplicates.

- allureReader.js: read links[type=tms] (the @TMslinK case) and use the
  link name as test_id; also recognize Testomat.io test-page URLs even when
  type is null/missing (real exporters omit it). Strip optional @/T markers,
  matching how XmlReader stores ids. Fall back to the URL's last segment when
  the link name is empty.
- fetchSourceCode no longer overrides a test_id already taken from a TmsLink.
- Tests for extractTestId/normalizeTestId and the processAllureResult wiring.
- docs/allure.md: document @TMslinK matching.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ink ids

Testomat.io test ids are always exactly 8 word-chars (TEST_ID_REGEX). The
TmsLink transform now validates this instead of blindly stripping prefixes:

- normalizeTestId only removes the @/T markers when the result is still a
  valid 8-char id, so a real id starting with T (e.g. "Tabcdef0") is no
  longer corrupted to 7 chars. The full @t<8> marker still normalizes to the
  bare 8-char id.
- Values that aren't valid 8-char ids (numeric Allure TestOps ids like 12345,
  JIRA keys, 6-digit TMS numbers) are rejected, so we never send an
  unmatchable test_id. Such tests still import — matched by title/historyId or
  created fresh.
- URL id extraction is anchored to the `/test/<8>` segment and tolerates query
  strings, instead of naively taking the last path chunk.

Verified on real fixtures: ios link (00062226) -> "00062226"; betterme link
(102308, non-Testomat) -> ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Step schema (testomat-api-definition.yml) supports a per-step status
(passed | failed | none | custom), but convertSteps dropped Allure's step
status, so failing steps were not highlighted in the report.

- New mapStepStatus: passed -> passed; failed/broken -> failed (broken is an
  unexpected error, a failure, consistent with mapStatus for tests);
  skipped/unknown/absent -> none (the step enum has no "skipped").
- convertSteps now sets status on every step, including nested ones.
- Tests for passed/failed/broken/skipped/missing and nested propagation;
  updated the simple-step assertion to include the new field.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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