Quick Start Guide
Get up and running with SpecTest in less than 3 minutes.
Prerequisites
Before starting, ensure you have:
- Go 1.22+ installed (or download a precompiled binary from GitHub Releases).
- An API specification in OpenAPI 3.x format (
openapi.yamloropenapi.json). - (Optional) An API key for an LLM provider (Google Gemini, OpenAI) or a running local instance of Ollama for scenario synthesis and AI defect triage.
Step 1: Install SpecTest
Step 2: Configure LLM Provider
SpecTest manages credentials securely in ~/.spectest/credentials.yaml with strict POSIX permissions (0600).
Verify your active settings:
Step 3: Generate Test Suite (spectest generate)
Analyze your OpenAPI contract and optional requirements document to synthesize an executable suite:
This creates:
- tests/spectest.yaml: Complete executable suite schema v1 (servers, apis, analysis, seed, setup, scenarios).
- tests/spectest.log.yaml: Initial base snapshot with canonical SHA-256 hash.
- tests/test_matrix.md: Human-readable coverage matrix mapping endpoints to scenarios.
Step 4: Run the Test Suite (spectest run)
1. Single Target Execution
Execute the suite against your running backend API:
2. Multi-Target Microservices
If your suite exercises multiple server aliases (e.g. {shop} and {billing}):
spectest run -f ./tests/spectest.yaml \
-t shop=http://localhost:8001 \
-t billing=http://localhost:8002
3. Automated Docker Compose Lifecycle & AI Triage
Spin up background databases or services, execute tests, and enable AI root cause analysis if any test fails:
spectest run -f ./tests/spectest.yaml \
--compose docker-compose.test.yml \
-t http://localhost:8080 \
--triage
4. Run Only Changed Scenarios
After an API contract update or revision, execute only the scenarios affected by the latest update entry in spectest.log.yaml:
Step 5: Launch the Interactive Web UI (spectest ui)
Prefer an interactive browser dashboard? Launch the embedded Web UI:
Open http://127.0.0.1:8088 to explore:
- Workspace: Upload OpenAPI and Markdown files.
- Suite Editor: Inspect scenarios, setups, and steps visually.
- Real-Time Runner: Trigger test runs with live Server-Sent Events (SSE) streaming logs, latency charts, and AI defect diagnoses.
- History: Inspect append-only audit entries and diffs.
Next Steps
- Review the spectest.yaml Suite Specification.
- Understand how spectest.log.yaml audits updates and calculates SHA-256 hashes.
- Read about the Execution Lifecycle & 9-Step HTTP Engine.
- Integrate automated regression gates in GitHub Actions.