Skip to content

Adopt snapshot testing library for user-facing output assertions #15

Description

@coderabbitai

Background

Raised by @leynos from #14.

Problem

Text-based UI output tests lack proper snapshot testing infrastructure:

  • Error messages in tests/unit/test_fafo_error_messages.py use hardcoded literal string assertions. Any change to user-facing output silently passes unless the literal is manually updated.
  • Integration tests use loose substring matching rather than exact message equality, allowing regressions in message wording, punctuation, or whitespace to go undetected.

Neither approach guarantees that changes to user-facing output receive explicit review.

Proposed solution

  1. Adopt a snapshot testing library (e.g. syrupy or pytest-snapshot) for error message assertions in test_fafo_error_messages.py, so that any change to user-facing output produces a snapshot diff requiring explicit approval.
  2. Tighten integration test assertions to exact message equality with whitespace sensitivity, removing loose substring checks.

Benefits

  • Changes to user-facing error messages surface in code review as snapshot diffs rather than silent test passes.
  • Whitespace, punctuation, and formatting regressions are caught automatically.
  • Snapshot files serve as living documentation of the expected CLI output.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions