Integrate OpenEvidence testing and validation into CI/CD pipelines. Covers GitHub Actions workflows, unit tests with SDK mocks, integration tests against sandbox, and clinical validation test suites.
Set up parallel jobs: lint-and-typecheck, unit-tests (with coverage), integration-tests (sandbox only, gated by branch/label), and clinical-validation (on main).
Create separate vitest configs: base (unit, 10s timeout), integration (60s timeout, retry 2, maxConcurrency 1 to avoid rate limits).
Mock @openevidence/sdk to test clinical query service logic, error handling, and response formatting without API calls.
Test against sandbox: verify clinical queries return answers with citations, validate empty queries fail gracefully, check citation fields.
Create known-answer test cases that verify responses contain expected medical keywords (e.g., "metformin" for diabetes, "statin" for cardiovascular) with confidence > 0.7.
Store OPENEVIDENCE_SANDBOX_API_KEY and OPENEVIDENCE_SANDBOX_ORG_ID as GitHub secrets. Use .env.test for local development.
| CI Issue | Cause | Solution |
|---|---|---|
| Integration test timeout | API slow or rate limited | Increase timeout, add retry |
| Secret not found | Missing GitHub secret | Add secret in repo settings |
| Flaky tests | Network variability | Add retries, improve assertions |
| Coverage drop | New code untested | Add tests, adjust thresholds |
{
"test:unit": "vitest run -c vitest.config.ts",
"test:integration": "vitest run -c vitest.config.integration.ts",
"test:clinical-validation": "vitest run tests/clinical-validation"
}
See detailed implementation for advanced patterns.