An AI-driven, explainable test automation optimization framework designed to improve CI CD pipeline efficiency by intelligently prioritizing high-risk test cases and providing transparent decision explanations.
Large regression suites are expensive to run for every build. Teams often execute too many tests, wait too long for feedback, and still struggle to focus on the most failure-prone areas. This project helps software teams rank tests using machine learning and explain why those tests should be run first.
- AI-based risk prediction with a production-friendly random forest model
- Explainable prioritization using SHAP
- Domain-agnostic input format for real projects
- FastAPI service for integration with internal tooling
- GitHub Actions CI workflow
- Docker support
- Sample data, tests, and outputs included
explainable-test-prioritizer/
├── .github/workflows/ci.yml
├── app.py
├── data/
├── docs/github_publish_steps.md
├── outputs/
├── src/explainable_test_prioritizer/
├── tests/
├── Dockerfile
├── prioritize.py
├── pyproject.toml
├── README.md
├── requirements.txt
└── train.py
Your CSV should include these columns:
test_idhistorical_defect_densitycode_complexitychange_frequencycoverage_gapexecution_costmodule_criticalityrecent_failure_countdependency_volatility
Training data must also include:
is_high_priority
git clone https://github.com/yourusername/explainable-test-prioritizer.git
cd explainable-test-prioritizer
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
python train.py --data data/train.csv
python prioritize.py --input data/new_build.csvThis generates:
outputs/prioritized_tests.csvoutputs/explanations.json
uvicorn app:app --reloadHealth check:
curl http://127.0.0.1:8000/healthPOST example:
curl -X POST http://127.0.0.1:8000/prioritize \
-H "Content-Type: application/json" \
-d @sample_request.jsonpytest -qdocker build -t explainable-test-prioritizer .
docker run -p 8000:8000 explainable-test-prioritizer- Export your historical test execution data into the required CSV schema.
- Train the model on your own project data:
python train.py --data path/to/your_train.csv
- For each new build, generate a candidate test list and features:
python prioritize.py --input path/to/new_build.csv
- Use
recommended_bucketandpriority_rankto select which tests run first in your CI pipeline. - Review
outputs/explanations.jsonto understand why the model ranked specific tests highly.
Create the repository with:
- Repository name:
explainable-test-prioritizer - Description:
Explainable AI-driven test prioritization engine that optimizes CI CD pipelines by predicting high-risk tests and providing transparent decision explanations using SHAP. - Visibility: Public
Recommended options:
- Add a README file
- Add .gitignore = Python
- Add license = MIT
Topics to add:
ai-testingtest-automationmachine-learningexplainable-aisoftware-qualityci-cd
Push this code:
git init
git add .
git commit -m "Initial commit - Explainable AI Test Prioritization Engine"
git branch -M main
git remote add origin https://github.com/yourusername/explainable-test-prioritizer.git
git push -u origin mainIf the repo already exists:
git clone https://github.com/yourusername/explainable-test-prioritizer.git
cd explainable-test-prioritizer
# copy extracted project files here
git add .
git commit -m "Add full project code and documentation"
git push origin mainCreate the first release:
- Tag:
v1.0.0 - Title:
Initial Release - Explainable AI Test Prioritization Engine
This project extends explainable AI in software engineering from defect prediction into actionable test selection and prioritization for CI CD pipelines.
Related publication:
S. Kavuri, An Explainable Machine Learning Framework for Predicting Software Defects in Large-Scale Software Systems, 2026 IEEE 5th International Conference on AI in Cybersecurity (ICAIC), Houston, TX, USA, 2026, pp. 1-6, doi: 10.1109/ICAIC67076.2026.11395777
- GitHub Actions workflow to auto-prioritize on pull requests
- dashboard visualizations for priority trends
- reinforcement learning for adaptive prioritization
- PyPI publishing
- DOI archival through Zenodo
MIT License