momus-cli
Momus API test harness — CLI runner.
What is this?
momus-cli is the command-line binary for the Momus API test harness. It provides a unified interface to all Momus capabilities: running and validating test plans, starting a mock server, load testing, fuzzing, chaos engineering, contract testing, security scanning, diff testing, and converting API descriptions into test plans.
Commands
Usage: momus <COMMAND>
Commands:
run Run a test plan from a JSON file
validate Validate a test plan JSON file
mock Start a mock server for testing
bench Load test a plan (steady, max-throughput, or soak)
fuzz Fuzz test a plan with payload mutations
chaos Run chaos experiments against a plan
convert Convert an API description into a test plan
contract Validate API responses against an OpenAPI/GraphQL spec
guard Security scan a plan for common vulnerabilities
diff Diff responses between two environments
init Generate a skeleton test plan or config file
plan Show a human-readable summary of a test plan
completions Generate shell completion scripts
docs Open the Momus documentation in your browser
fhir FHIR-specific operations (mock, validate, generate, openapi, upload, delete)
momus run
# Run with default output directory (./output/run)
# Override base URL
# Custom output directory
# Dry-run: validate and print the resolved requests without sending anything
Every command writes its reports to a dedicated subfolder under ./output/ by
default, so all results live in one place:
| Command | Default output |
|---|---|
run |
./output/run/ |
bench |
./output/bench/ |
fuzz |
./output/fuzz/ |
chaos |
./output/chaos/ |
contract |
./output/contract/ |
guard |
./output/guard/ |
diff |
./output/diff/ |
plan |
./output/plan/ |
fhir generate |
./output/fhir/ |
Override any of these with --output <path> (or the output key in the config
file).
--dry-run parses and validates the plan, resolves templates where statically
possible (e.g. {base_url}, {env.*}), and prints the resolved request list
(method, URL, headers, body size, assertion count) without making any network
requests. Sensitive headers (Authorization, Cookie, token, etc.) are redacted.
It exits non-zero if the plan fails validation (e.g. a relative URL with no
base_url set).
momus validate
# ✓ Valid test plan: 'health check'
# Total tests: 3
# Steps: 1
momus mock
# Momus mock server listening on http://127.0.0.1:8091
momus bench
# Steady load: 50 concurrent users for 60 seconds
# Override base URL
# Max-throughput: ramp concurrency until error rate or P99 latency threshold is breached
# Soak: sustained load for a long duration
# Warmup requests before recording (excluded from stats)
# Machine-readable JSON summary output
bench supports three modes: steady (default), max-throughput, and soak.
Latency percentiles (P50/P90/P95/P99) are recorded with an HDR histogram and
warmup requests are excluded from the reported statistics. --format json
emits a versioned (schema_version: 1) machine-readable report suitable for
CI dashboards and trend tracking. Pressing Ctrl+C stops the benchmark early and
still prints a partial report with whatever results were collected.
momus fuzz
# Generate 5000 mutations
# Override base URL
momus chaos
# Run chaos experiments against a plan
# Override base URL
momus convert
# Convert a cURL command into a test plan
# Convert a HAR file into a test plan
# Convert an OpenAPI spec into a test plan
# Convert a Postman collection into a test plan
# Convert a GraphQL schema into a test plan
# Convert a gRPC proto into a test plan
# Convert a FHIR IG package into a test plan
# Generate bulk FHIR test data (NDJSON) from an IG package
# Upload the generated data to a repository endpoint before running tests.
# The repository endpoint may differ from the FHIR server under test, and
# accepts resources directly via PUT (default) with basic auth:
# Delete the uploaded resources (cleanup after tests):
momus contract
# Validate responses against an OpenAPI spec
# Validate responses against a GraphQL schema
momus guard
# Security scan a plan
# Override base URL
momus diff
# Diff responses between two environments
momus completions
# Generate shell completions and install them
completions supports any shell clap_complete knows about (bash, zsh, fish,
elvish, powershell, nushell).
momus docs
# Opening documentation: https://docs.rs/momus
Opens the Momus documentation (https://docs.rs/momus) in your default browser. If a browser cannot be opened (e.g. headless environment), the URL is printed instead and the command never fails hard.
momus fhir
FHIR-specific operations for working with FHIR Implementation Guide packages.
# Start a FHIR mock server with CRUD + search support
# Validate a JSON resource against a profile from an IG package
# Validate with auto-detected profile (by resourceType)
# Generate bulk FHIR test data (NDJSON) from an IG package
# Generate an OpenAPI 3.x spec (YAML) from a FHIR IG package
# Generate a JSON spec and write it to a file
# Generate an OpenAPI spec from a live FHIR server's CapabilityStatement (/metadata)
Configuration
Momus is configured with a single TOML file. Each sub-command reads its own
section ([run], [bench], [fuzz], [chaos], [contract], [guard],
[diff], [plan]), and a [global] section provides cross-cutting defaults
inherited by all commands. See the commented config.toml at the repo root for
a fully documented template.
Discovery
The config file is located from, in order:
--config <path>(explicit)$MOMUS_CONFIG(environment variable)./momus.toml./.momus.toml~/.config/momus/config.toml
If no config file is found, built-in defaults are used.
Precedence
Values are resolved with the following precedence (highest wins):
CLI flags > environment variables > config file > plan > built-in defaults
For example, momus run plan.json --base-url https://api.example.com overrides
both the [run]/[global] base_url in the config file and the plan's
base_url.
Environment-variable interpolation
Any string value in the config file may reference an environment variable with
$VAR or ${VAR} syntax:
[]
= "$API_URL"
Unset variables are left as-is so you see the placeholder in error messages rather than a silent empty string.
Cross-cutting settings
The [global] section covers settings shared by all commands:
[]
= "http://localhost:8080"
= 60
= "./output" # base directory; commands write to ./output/<command>/
= "html" # auto, text, html, junit, json
[]
= "Bearer your-token-here"
[]
= 3
= 2
[]
= true # dev only
# proxy = "http://proxy.example.com:3128"
Environment profiles
Per-environment overrides are declared as [env.<name>] sections and applied
with the MOMUS_ENV environment variable:
[]
= "https://staging.example.com"
= 60
MOMUS_ENV=staging
Per-command sections
Each sub-command reads its own section without duplicating parsing logic. For
example, [bench] configures load testing and [diff] configures regression
comparison:
[]
= { = "Steady", = 20, = 60 }
= 10
[]
= "https://prod.example.com"
= "https://staging.example.com"
= true
= true
= true
Unknown fields are rejected with a clear error (so typos fail fast), and a missing config file reports the path that was attempted.
Part of the Momus project — a generic API test harness with a composable assertion AST.