Multi-agent testing infrastructure for monoliths and microservices. Works seamlessly with both Node.js and Python projects.
- 🤖 Multi-Agent Parallel Execution - Run tests across multiple agents simultaneously
- 🧪 Framework Support - Vitest, Pytest, Playwright
- 🐳 Testcontainers - Real database instances for integration tests
- 📝 Component Specs - YAML-based test organization
- 🎯 AI-Powered Generation - Auto-generate tests from code analysis
- 🚀 Zero Config - Auto-detect project type and setup
IMPORTANT: test-rig is designed for headless, background execution. All commands default to non-interactive mode.
For CI/CD and agent usage:
- Commands auto-detect CI environments
- Interactive prompts are disabled
- Use
--yesflag to skip confirmations - All tests run in background/headless mode
npm install -g @hcb-consulting/test-riggit clone https://github.com/HCB-Consulting-ME/test-rig
cd test-rig
npm install
npm run build
npm link# Clone and install
git clone https://github.com/HCB-Consulting-ME/test-rig /opt/test-rig
cd /opt/test-rig
npm install --production
npm link
# Verify installation
test-rig --version# Navigate to your project
cd ~/projects/your-project
# Setup test infrastructure (non-interactive)
test-rig setup --yes
# Generate tests for a component (headless)
test-rig generate user-service --non-interactive
# Run tests (background)
test-rig run --headless
# Run tests in parallel (multi-agent)
test-rig run --parallel --agents 4 --headless
# Check coverage
test-rig coverage --headlessAll test-rig commands MUST run in headless mode:
✅ CORRECT - Non-interactive execution:
test-rig setup --yes
test-rig generate auth-service --non-interactive
test-rig run --headless
test-rig run --parallel --agents 4 --headless❌ INCORRECT - Interactive prompts (blocks agents):
test-rig setup # Will prompt for input
test-rig generate auth # May ask questions
test-rig run # Without --headless flagtest-rig auto-detects CI environments and disables interactive mode:
- GitHub Actions (GITHUB_ACTIONS)
- GitLab CI (GITLAB_CI)
- Jenkins (JENKINS_HOME)
- Generic CI (CI=true)
- Non-TTY environments
⚠️ WARNING: Interactive mode is for manual use only. Coding agents and CI/CD pipelines must use--yesor--headlessflags.
Initialize test infrastructure for the current project.
- Auto-detects project type (Node.js/Python)
- Installs appropriate test frameworks
- Creates folder structure
- Generates configuration files
Usage:
test-rig setup --yes # Non-interactive
test-rig setup --yes --verbose # Non-interactive with logsGenerate tests for a specific component.
- Analyzes component code
- Creates component spec (YAML)
- Generates unit tests
- Generates integration tests
- Creates test data factories
Usage:
test-rig generate user-service --non-interactive
test-rig generate auth-service --non-interactive --verboseRun tests.
test-rig run --headless- Run all tests (headless)test-rig run unit --headless- Unit tests onlytest-rig run integration --headless- Integration tests onlytest-rig run e2e --headless- E2E tests onlytest-rig run --parallel --agents 4 --headless- Multi-agent parallel execution
Usage:
test-rig run --headless
test-rig run --parallel --agents 4 --headlessGenerate coverage report.
Usage:
test-rig coverage --headlessAnalyze codebase for testability.
Usage:
test-rig analyze --headlessCheck test setup health.
Usage:
test-rig doctor --verbose --headlessCreate test-rig.config.yaml in your project root:
framework: vitest # or pytest
parallel_agents: 4
containers:
- postgres:5432
- redis:6379
coverage_threshold:
unit: 80
integration: 60Component specs define testable units for parallel execution:
# tests/specs/user-service.spec.yaml
component:
name: user-service
type: service
subcomponents:
- name: repository
test_file: tests/unit/user-service/repository.spec.ts
dependencies: [database]
- name: validator
test_file: tests/unit/user-service/validator.spec.ts
dependencies: []
- name: service
test_file: tests/unit/user-service/service.spec.ts
dependencies: [repository, validator]Test-rig spawns multiple agents to run tests in parallel:
test-rig run --parallel --agents 4 --headlessEach agent:
- Picks a component from the queue
- Starts its own testcontainers
- Runs component tests
- Reports results
Result: 3-4x faster test execution with no conflicts.
For coding agents: Always use --headless flag to ensure non-interactive execution.
your-project/
├── tests/
│ ├── specs/ # Component specs (YAML)
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ ├── e2e/ # End-to-end tests
│ ├── factories/ # Test data factories
│ ├── fixtures/ # Static test data
│ ├── mocks/ # Mock objects
│ └── utils/ # Test utilities
└── test-rig.config.yaml # Configuration
- Node.js (Express, Fastify, Nest.js)
- Python (FastAPI, Flask, Django)
- Mixed tech stacks
- Service-by-service testing
- Contract testing
- Cross-service integration tests
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- run: npm install -g @hcb-consulting/test-rig
- run: test-rig setup --yes
- run: test-rig run --parallel --agents 4 --headlesstest:
image: node:18
before_script:
- npm install -g @hcb-consulting/test-rig
script:
- test-rig setup --yes
- test-rig run --parallel --agents 4 --headless# /etc/systemd/system/test-rig-api.service
[Unit]
Description=Test-Rig API Server
After=network.target
[Service]
Type=simple
User=testrig
WorkingDirectory=/opt/test-rig
ExecStart=/usr/bin/node /opt/test-rig/dist/server/index.js
Restart=always
[Install]
WantedBy=multi-user.targetFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
RUN npm run build
CMD ["node", "dist/cli/index.js", "serve"]Run test-rig as an API server:
test-rig serve --port 8080API endpoints:
POST /test/run- Run testsPOST /test/generate- Generate testsGET /test/status- Get test statusGET /coverage- Get coverage report
# Clone repository
git clone https://github.com/HCB-Consulting-ME/test-rig
cd test-rig
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Link locally
npm link
# Test
npm testMIT