Class AssertionEvidenceReporter

java.lang.Object
com.shaft.tools.io.internal.AssertionEvidenceReporter

public final class AssertionEvidenceReporter extends Object
Renders a self-contained HTML "assertion evidence" card for a single Assert/Verify validation, redacting secrets and diffing expected/actual values, so Allure attachments can show exactly what a validation compared without leaking sensitive data or exceeding a bounded size.
  • Method Details

    • renderCard

      public static String renderCard(String categoryLabel, boolean passed, Object expected, Object actual)
      Renders a self-contained HTML "assertion evidence" card for one validation.
      Parameters:
      categoryLabel - "Assert" (hard) or "Verify" (soft) — as passed by ValidationsHelper
      passed - true when the validation passed
      expected - the reported expected value (may be null)
      actual - the reported actual value (may be null)
      Returns:
      a complete self-contained HTML document string, or "" when there is nothing meaningful to show (both expected and actual are null/blank)
    • renderAccessibilityCard

      public static String renderAccessibilityCard(boolean passed, Object expectedYaml, Object actualYaml)
      Renders a domain-consistent evidence card for an accessibility (aria snapshot) validation.

      Accessibility validations report their outcome as a pass/fail boolean, which renderCard(String, boolean, Object, Object) deliberately skips because a "true vs false" flag carries no comparable content. This overload instead takes the expected/actual aria-snapshot YAML so the card can show the same bounded, redacted line diff assertion cards use — a summary line plus a deep attachment, rather than a full YAML dump in the step name (issue #3532 E).

      Parameters:
      passed - true when the aria snapshot matched its baseline
      expectedYaml - the baseline aria-snapshot YAML (may be null/blank on first capture)
      actualYaml - the captured aria-snapshot YAML
      Returns:
      a complete self-contained HTML document string, or "" when there is nothing meaningful to show (both sides are null/blank)
    • renderVisualCard

      public static String renderVisualCard(boolean passed, long diffPixels, Integer maxDiffPixels, double diffRatio, Double maxDiffRatio)
      Renders a domain-consistent evidence card for a visual (screenshot) validation.

      Visual validations also report their outcome as a pass/fail boolean, so renderCard(String, boolean, Object, Object) skips them; the pixel diff is attached separately as a native Allure image-diff viewer. This overload surfaces the numeric comparison metadata — diff pixels and diff ratio against their budgets — as a compact summary card, so the report answers "how far off was it?" in text without a full dump, and points at the attached image diff (issue #3532 E).

      Parameters:
      passed - true when the screenshot matched its baseline within budget
      diffPixels - number of differing pixels reported by the comparison
      maxDiffPixels - the pixel-count budget, or null when none was configured
      diffRatio - the differing-pixel ratio reported by the comparison
      maxDiffRatio - the ratio budget, or null when none was configured
      Returns:
      a complete self-contained HTML document string