1min.

1MIN · GO

Testing a Go CLI means checking what the user actually sees

Wesley Beary describes testing Anchor’s Go CLI by scripting interactions and comparing terminal output with saved reference files. Temporary spinners made those checks inconsistent, so the team captured rendering changes more deliberately and normalised generated values. The useful distinction is between proving that a function ran and verifying the experience a person sees at the terminal.

Go Time · Nov 12, 2024

Why it matters

Terminal UI tests can catch regressions that command-handler unit tests miss.

More context

An older, 58-minute episode with an accessible transcript. This card covers the CLI testing discussion around 06:08–14:08, not the full interview. Try one scripted user interaction and inspect how asynchronous output affects its reference file.

Keep in mind

The guest describes one team’s 2024 experience with Cobra and Bubble Tea. Library capabilities may have changed; the approach still needs adaptation for your own rendering and timing behaviour.

Transcript read

More engineering ideas, one minute at a time.

Explore more stories