Skip to content

Latest commit

 

History

History
98 lines (69 loc) · 2.3 KB

File metadata and controls

98 lines (69 loc) · 2.3 KB

OpenClaw Testing Reference

Test Suites

Suite Command Credentials CI-safe
Unit/Integration pnpm test None Yes
E2E (Gateway) pnpm test:e2e None Yes
Live pnpm test:live Real API keys No

Daily Dev Loop

pnpm build && pnpm check && pnpm test

E2E Testing

Validates multi-instance gateway, WebSocket/HTTP, node pairing.

pnpm test:e2e

Env vars:

  • OPENCLAW_E2E_WORKERS: Worker count (2-4 CI, 4-8 local)
  • OPENCLAW_E2E_VERBOSE: Verbose output

Live Testing

Two layers:

Layer 1 - Direct Model Completion: Tests provider/model response with real credentials.

OPENCLAW_LIVE_MODELS=modern pnpm test:live

Layer 2 - Gateway + Agent Smoke: Full agent pipeline with read/exec/image probes.

Credential Discovery

  1. Profile store: ~/.openclaw/credentials/ (preferred)
  2. Environment variables
  3. Config: ~/.openclaw/openclaw.json
  4. Auto-sources ~/.profile

Key Env Vars

Variable Purpose
OPENCLAW_LIVE_MODELS Model allowlist (e.g., modern)
OPENCLAW_LIVE_GATEWAY_MODELS Gateway model allowlist
OPENCLAW_LIVE_PROVIDERS Provider filter
OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS Profile-store only
OPENCLAW_LIVE_SETUP_TOKEN Anthropic setup-token test
OPENCLAW_LIVE_CLI_BACKEND CLI backend test
OPENCLAW_TEST_VM_FORKS Override VM forking (0/1)

Docker-based Testing

pnpm test:docker:live-models
pnpm test:docker:live-gateway

Mounts ~/.openclaw and sources ~/.profile.

Regression Testing

Prefer CI-safe regressions with mock/stub providers. Target the smallest failing layer:

  • Provider conversion
  • Gateway session handling
  • Tool pipelines

Dev Gateway for Manual Testing

# Terminal 1: gateway in dev mode
openclaw --dev gateway --port 19001 --verbose --force

# Terminal 2: TUI connected to dev gateway
openclaw --dev tui

# Terminal 3: tail logs
openclaw --dev logs --follow

Stream Debugging

# Raw assistant output before formatting
OPENCLAW_RAW_STREAM=1 openclaw --dev gateway --port 19001

# Raw protocol chunks before parsing
PI_RAW_STREAM=1 openclaw --dev gateway --port 19001

Logs to .jsonl files. Contains sensitive data - delete after debugging.