cli-testing
Skill1 starsChanged 52 days agoMITView on GitHub
Use when testing command-line tools and scripts — exit codes, stdout/stderr contracts, flags and argument parsing, help/version output, stdin/pipes, env/config precedence, cross-platform paths, signals, idempotency, and Bats/pytest/expect-based automation.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- vellum-ai/vellum-assistanttheir own version, first seen Jul 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- vellum-ai/vellum-assistant★ 1.5ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository98 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 42crunch-api-security-testingSkill
- a-b-testingSkill
- acceptance-testingSkill
- accessibility-testingSkill
- ai-agent-evaluationSkill
- ai-code-securitySkill
- ai-ml-testingSkill
- analytics-tracking-testingSkill
- api-testingSkill
- authn-authz-testingSkill
- autonomous-qa-orchestrationSkill
- bdd-gherkin-testingSkill
- blockchain-smart-contract-testingSkill
- bug-reportingSkill
- chaos-resilience-testingSkill
- chatbot-voice-agent-testingSkill
- cicd-testingSkill
- cloud-infrastructure-testingSkill
- code-coverage-analysisSkill
- compatibility-testingSkill
- compliance-testingSkill
- concurrency-race-condition-testingSkill
- configuration-feature-flag-testingSkill
- contract-testingSkill
- cross-browser-testingSkill
- database-testingSkill
- data-migration-testingSkill
- data-pipeline-etl-testingSkill
- date-time-timezone-testingSkill
- desktop-app-testingSkill
- disaster-recovery-backup-testingSkill
- e2e-testingSkill
- email-notification-testingSkill
- event-driven-messaging-testingSkill
- exploratory-testingSkill
- flaky-test-managementSkill
- functional-testingSkill
- fuzz-testingSkill
- game-testingSkill
- graphql-testingSkill
- iac-container-security-testingSkill
- installation-upgrade-testingSkill
- integration-testingSkill
- iot-embedded-testingSkill
- llm-security-auditSkill
- llm-testingSkill
- localization-testingSkill
- manual-testingSkill
- mcp-testingSkill
- memory-leak-resource-testingSkill
- microservices-testingSkill
- mobile-testingSkill
- mutation-testingSkill
- observability-testingSkill
- payment-ecommerce-testingSkill
- performance-testingSkill
- production-monitoring-synthetic-testingSkill
- property-based-testingSkill
- The first 60 shown.
The file
Files
CLI Testing
A CLI's API is: args + env + stdin → stdout + stderr + exit code + side effects. Test that contract.
Contract checklist
| Aspect | Verify | |
| Exit codes | 0 success; non-zero on failure (documented: 1 general, 2 usage, 64–78 sysexits); consistent | |
| Streams | Data → stdout; diagnostics/progress → stderr; nothing extra on stdout (pipe-safe) | |
| Help/version | -h/--help exit 0, lists all flags, examples; --version machine-readable | |
| Args | Unknown flag → usage error (exit 2); missing required arg; -- separator; flag=value & flag value; short-flag bundling -abc; repeated flags; negative numbers | |
| Input | stdin -; empty stdin; huge stdin; binary; CRLF; TTY vs pipe detection | |
| Output modes | --json valid & stable schema; --quiet/--verbose; color disabled when not TTY or NO_COLOR set | |
| Config precedence | flag > env > project config > user config > defaults (test each layer) | |
| Files | Nonexistent, directory instead of file, no permission, symlink, spaces/unicode paths, ~ expansion, overwrite prompts/--force, atomic writes | |
| Idempotency | Running twice is safe; --dry-run changes nothing | |
| Signals | SIGINT/SIGTERM → cleanup, partial files removed, exit 130/143; SIGPIPE handled (` | head`) |
| Interactivity | Prompts have non-interactive override (--yes); no hang in CI | |
| Cross-platform | Windows paths/CRLF/quoting, macOS BSD vs GNU coreutils, locale LANG=C | |
| Security | No secrets in argv (visible in ps); shell-injection via args/filenames; tmp files 0600; safe deserialization | |
| Performance | Startup time; large input streaming (constant memory) |
Tooling
# Bats (bash)
#!/usr/bin/env bats
@test "prints version" { run mycli --version; [ "$status" -eq 0 ]; [[ "$output" =~ ^mycli\ [0-9]+\.[0-9]+ ]]; }
@test "rejects unknown flag" { run mycli --nope; [ "$status" -eq 2 ]; [[ "$output" == *"Usage"* ]]; }# pytest + subprocess
import subprocess, json
def run(*a, inp=None): return subprocess.run(["mycli",*a], input=inp, capture_output=True, text=True)
def test_json_mode():
r = run("list","--json"); assert r.returncode == 0 and r.stderr == ""
assert isinstance(json.loads(r.stdout), list)Other: cram/prysk (transcript tests), expect/pexpect/node-pty for interactive TTY flows, snapshot-golden-testing for help text and reports, shellcheck + shfmt for shell scripts, Go testscript, Rust assert_cmd + predicates, Node execa.
Test the installed artifact
Package (npm/pip/brew/cargo/binary), install into a clean container, run smoke commands, verify shebang/permissions/completions (bash, zsh, fish), man page, --version matches tag.
Related
unit-testing, integration-testing, snapshot-golden-testing, installation-upgrade-testing, fuzz-testing
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

