htop

The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not htop’s official test suite, and the htop project is not affiliated with atago.

Summary #

1 suite · 4 scenarios

Contents #

htop (third-party CLI, full-screen TUI testbed) #

htop is a full-screen program in the strict sense: it switches the terminal to the alternate screen buffer, paints meters and a process table with cursor movement and color, and restores what was there before when it quits.

That is a harder thing to assert than scrolling output, and it is what this suite pins. The rendered frame is reconstructed the way a terminal would reconstruct it — following the alternate-screen switch and the cursor movements — so the assertion is about what a user sees on screen, not about the raw escape sequences that produced it. Quitting cleanly, and leaving the terminal in a usable state, is part of the contract too.

Source: test/e2e/thirdparty/htop/htop.atago.yaml

Scenario: version prints a semantic version #

only when htop --version succeeds

When #

htop --version

Then #

  • exit code is 0
  • stdout matches /^htop [0-9]+\.[0-9]+/

Scenario: an unrecognized option is rejected without opening the TUI #

only when htop --version succeeds

When #

htop --nonexistent-flag

Then #

  • exit code is not 0
  • stderr contains unrecognized option

Scenario: the finder loads its function-key bar and quits on q #

only when htop --version succeeds · skipped on Windows

When #

# interactive (pty): htop

Then #

  • exit code is 0

Scenario: the rendered screen shows the live meters and column header #

only when htop --version succeeds · skipped on Windows

When #

# interactive (pty): htop

Then #

  • rendered screen contains CPU%
  • rendered screen contains Command
  • rendered screen contains F10