Test prioritization engine - ranks tests by execution priority using risk signals (code churn, failure history, change proximity, business criticality) to run the most valuable tests first within time budgets.
- Multi-Signal Risk Scoring - Combine code churn, failure history, change coverage, and criticality
- Priority Ranking - Sort tests highest-to-lowest value for execution order
- Time Budget Selection - Given N minutes, select the highest-value tests that fit
- Code Churn Analysis - Files changed frequently produce higher-priority tests
- Failure History - Recently failed tests get promoted in execution order
- Business Criticality - Tag tests by feature importance (critical > high > medium > low)
- Configurable Weights - Tune signal importance per team or project
- Execution Plan Output - Ordered file path list ready for any test runner
Test Metadata + Changed Files + Churn Map
|
v
[Risk Signal Calculator]
- Code churn (0-1)
- Recent failure (0-1)
- Change coverage (0-1)
- Criticality (0-1)
|
v
[Weighted Score: 0-100]
|
v
[Priority Ranker] --> Sorted test list
|
v
[Budget Selector] --> Tests that fit in N minutes
| Signal | Weight | Description |
|---|---|---|
| Recent Failure | 35% | Tests that failed recently are more likely to catch regressions |
| Change Coverage | 25% | Tests covering currently changed code are directly relevant |
| Code Churn | 20% | Frequently modified code is more likely to contain bugs |
| Business Criticality | 20% | Payment tests matter more than tooltip tests |
Given 50 tests and a 5-minute CI budget:
Total tests: 50 (would take 18 minutes)
Budget: 5 minutes
Selected: 14 highest-priority tests
Coverage: 28% of tests, but 85% of risk
The 14 selected tests cover the most recently changed, most failure-prone, most critical paths first.
test-prioritization-engine/
+-- src/
| +-- config/ # Configuration, logger, defaults
| +-- scoring/ # Risk signal calculation + priority scoring
| +-- prioritizer/ # Ranking + time budget selection
| +-- engine/ # Full orchestration pipeline
| +-- api/ # Express REST server
| +-- index.ts # CLI entry point
+-- tests/unit/ # Unit tests (20+ tests)
+-- .github/workflows/ # CI pipeline
+-- Dockerfile # Multi-stage Docker build
+-- docker-compose.yml
+-- package.json
+-- tsconfig.json
+-- README.md
+-- LICENSE
- Node.js >= 20.0.0
- Docker (optional)
git clone https://github.com/Djones-qa/test-prioritization-engine.git
cd test-prioritization-engine
npm install
cp .env.example .env
npm run devnpm test # All tests
npm run test:unit # Unit tests only
npm run test:coverage # With coverage
npm run lint # ESLint| Variable | Default | Description |
|---|---|---|
| PORT | 3011 | Server port |
| NODE_ENV | development | Environment |
| LOG_LEVEL | info | Winston log level |
| WEIGHT_CHURN | 0.2 | Code churn signal weight |
| WEIGHT_FAILURE | 0.35 | Recent failure signal weight |
| WEIGHT_COVERAGE | 0.25 | Change coverage signal weight |
| WEIGHT_CRITICALITY | 0.2 | Business criticality weight |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health | Service health check |
- Lint & Type Check - ESLint + TypeScript compiler
- Unit Tests - Jest with coverage
- Docker Build - Multi-stage production image
Darrius Jones
- GitHub: @Djones-qa
- LinkedIn: darrius-jones-28226b350
MIT - 2026 Darrius Jones
See LICENSE for details.