CLI
CLI Reference
The TestMesh CLI executes flows locally without needing the API server running.
The TestMesh CLI is a standalone tool that parses and executes flow YAML files directly against your services. It does not require the TestMesh API server or dashboard to be running.
Installation
brew install test-mesh/brew/testmesh
testmesh --helpcurl -fsSL https://testmesh.io/install.sh | sh
testmesh --helpnpm install -g @testmesh/cli
testmesh --helpcd cli
go build -o testmesh main.go
./testmesh --helpCommands
| Command | Description |
|---|---|
run | Execute a flow file and display results |
validate | Check YAML syntax without executing |
debug | Execute step-by-step with interactive inspection |
watch | Auto-re-run a flow when the file changes |
generate | AI-powered flow generation from specs or descriptions |
chat | Conversational test creation with AI |
mock | Start a local mock HTTP server |
graph | Scan repos, view services, check coverage |
init | Initialize a new TestMesh project |
login | Authenticate with a TestMesh server |
report | View execution reports |
import | Import from Postman collections or OpenAPI specs |
export | Export flows to other formats |
config | Manage CLI configuration |
schedule | Manage scheduled flows |
mcp | Start the MCP server for AI integration |
Global Flags
| Flag | Default | Description |
|---|---|---|
--api-url | http://localhost:5016 | TestMesh API URL — point this at a remote instance |
--config | .testmesh.yaml | Config file path |
--verbose / -v | false | Enable verbose output |
Environment Variables
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | API key for AI-powered commands (generate, chat) |
OPENAI_API_KEY | Alternative API key for OpenAI models |
DATABASE_URL | Default PostgreSQL connection string for database_query steps |
REDIS_URL | Default Redis connection string for redis_get/redis_set steps |
Common Patterns
Run Against a Specific Environment
Override the base URL or any variable inline:
BASE_URL=https://staging.example.com testmesh run ./flow.yamlRun All Flows in a Directory
for f in ./flows/*.yaml; do testmesh run "$f"; doneCI/CD Integration
The CLI exits with a non-zero code on failure, making it straightforward to use in pipelines:
testmesh run ./flows/smoke-tests.yaml || exit 1Or with explicit exit code checking:
testmesh run ./flows/e2e.yaml
echo "Exit code: $?"Exit Codes
| Code | Meaning |
|---|---|
0 | All assertions passed |
1 | One or more assertions failed |
2 | Invalid flow YAML or configuration error |