Golden Testing a CAD Library

· design ai books · Source ↗

TLDR

  • Waterfall-CAD author spent three years without tests, then added SVG output to enable pixel-diff golden testing via tasty-golden and Rasterific-SVG.

Key Takeaways

  • Golden testing (aka snapshot/characterization testing) stores expected output in files and diffs current output against them; visual regression testing is the image-specific variant.
  • Waterfall-CAD converts 3D models to SVG, rasterizes both reference and generated SVG with Rasterific-SVG, then counts pixels differing by Manhattan distance above a tolerance threshold.
  • Test failures produce a highlighted diff image; the reference SVGs double as README diagrams with dark-mode CSS, reducing sync overhead.
  • The pixel-comparison logic is close to a standalone JuicyPixels visual-diff library but needs broader pixel format support and customizable diff colors before extraction.
  • tasty-golden and its fork tasty-silver are the relevant Haskell ecosystem tools; the author is open to publishing a library if there is demand.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN