Skip to content

Test Bot CLI

Tobias Vorwachs edited this page Oct 27, 2026 · 2 revisions

Test bot CLI

Every mumbot subcommand except webhook drives the scripted test bot: it connects, runs a step (or a whole script) and exits. Exit code 0 means the step passed; an error or timeout prints the reason on stderr and exits with 1.

Use it only against local or throwaway test servers. Full reference: docs/cli.md.

Global options

Option Default Meaning
--host, --port 127.0.0.1, 64738 Server.
--name Bot User name.
--cert the name Persistent certificate name; reuse to keep the identity.
--superuser off Log in as SuperUser (admin steps).
--timeout 10 Seconds for login and each wait.
--hold 0 Seconds to wait before exiting (fixed in 0.1.1, #14).

Subcommands

Group Subcommands
Connection and user connect, rename, register, avatar, comment, join, listen, unlisten, mute, deaf
Chat say, say-sample (bold, link, image, rich, script, external-image), pm
Admin (need --superuser) moderate, move, deny-speak, allow-speak, deny-listen, allow-listen, describe
Expect (checks) expect user, expect user-gone, expect message, expect denied
Voice play, record, expect-audio, game-context (see Voice checks)
Script script (steps from stdin), sleep

expect user checks: --in, --muted, --deaf, --listening, --not-listening, --registered, --comment-contains, --has-avatar, --avatar-file, --cert-hash. expect message checks: --from, --contains, --private, --channel.

Examples

# Is Alice in "Raid" and unmuted? Exit code 0 = yes.
mumbot --port 44738 --name Observer expect user Alice --in Raid --muted false

# One connection, several steps, one per line.
printf '%s\n' 'join Lobby' 'say "<b>hello</b>"' 'expect message --from Alice --contains hi' \
  | mumbot --port 44738 --name Bob script

End a script that sends something with sleep 1, so the server receives it before the bot disconnects.

How Mumcord uses it

Mumcord's end-to-end and smoke tests play a second user with this bot. It moves into channels, mutes, chats and sends voice, while the test checks what the Mumcord client shows. Failures show up as a non-zero exit code. The bot was carried over from Mumcord's own repository.

How Mumcord's E2E tests use the bot

Mumcord uses a pinned release of this bot, not a copy of the code:

  • scripts/mumbot.env in the Mumcord repository holds the version (currently 0.1.1) and the SHA256 of every release archive (from the release's SHA256SUMS).
  • scripts/fetch-mumbot.sh <linux-x86_64|linux-aarch64|windows-x86_64|macos-universal> <dest> downloads the archive, checks the hash and unpacks the binary. Archives are cached in ~/.cache/mumbot.
  • E2E: the build step fetches the Linux x86_64 binary next to the app binaries, and the test container exports MUMCORD_TESTENV_DIR (where the test server's .env with the SuperUser password lives) and MUMCORD_BOT_DATA (where the bot keeps its certificates).
  • Smoke test: each CI job fetches the binary for its own platform and passes it to smoke.sh --bot.
  • Live engine tests: they use the mumbot library at the same tag.

To move Mumcord to a new bot release, bump all lines in mumbot.env together.

Clone this wiki locally