Automated integration testing using JBang + AI validation.
-
JBang - Install from https://www.jbang.dev/
curl -Ls https://sh.jbang.dev | bash -s - app setup -
Claude Code SDK - Must be installed in local Maven repo
cd ~/path/to/claude-code-sdk-java ./mvnw install -DskipTests
-
Claude CLI - Required for AI validation
npm install -g @anthropic-ai/claude-code
-
GEMINI_API_KEY (optional) - Required for modules 01-08
export GEMINI_API_KEY=your-key-here
cd integration-testing
# Run a single test
jbang RunIntegrationTest.java module-12-echo-agent
# Run all local tests (no API key needed)
./scripts/run-integration-tests.sh --local
# Run all tests (requires GEMINI_API_KEY)
./scripts/run-integration-tests.sh
# List available modules
jbang RunIntegrationTest.java --list| Module | Description |
|---|---|
| module-12-echo-agent | Minimal echo agent |
| module-13-agent-handlers | All handler types |
| module-14-sending-updates | Agent sends all update types |
| module-15-agent-requests | Agent requests files/permissions |
| module-16-in-memory-testing | In-memory transport testing |
| Module | Description |
|---|---|
| module-01-first-contact | Basic connection and prompt |
| module-02-protocol-basics | Initialize handshake |
| module-03-sessions | Session lifecycle |
| module-04-prompts | Prompt/response and stop reasons |
| module-05-streaming-updates | Real-time updates |
| module-06-update-types | All SessionUpdate types |
| module-07-agent-requests | Client file handlers |
| module-08-permissions | Permission handling |
- Load Config - Read JSON config from
configs/<module>.json - Verify Environment - Check required environment variables
- Build Module - Run
mvn compileormvn package - Run Module - Execute via
mvn exec:java - AI Validation - Use Claude to validate output against expected behavior
{
"moduleId": "module-XX-name",
"displayName": "Module XX: Title",
"timeoutSec": 120,
"requiredEnv": ["GEMINI_API_KEY"],
"requiresPackage": false,
"expectedBehavior": "Description of what the module should demonstrate..."
}moduleId- Maven module namedisplayName- Human-readable nametimeoutSec- Max execution timerequiredEnv- Required environment variablesrequiresPackage- If true, runsmvn packageinstead ofmvn compileexpectedBehavior- Description for AI validation
Uses Claude (via claude-code-sdk) to semantically validate test output:
- No brittle regex patterns
- Understands expected behavior descriptions
- Returns structured result with confidence score
- Cost: ~$0.001 per validation using Claude Haiku
Test output is saved to logs/<module>-<timestamp>.log
Make sure you're in the integration-testing directory.
Export the environment variable or use --local flag to skip Gemini tests.
Run ./mvnw compile -pl module-XX-name from repo root to see build errors.
Check that Claude CLI is installed and working: claude --version