AI-Powered Test Flakiness Detection & Root Cause Analysis - Enterprise-grade analytics for test reliability
Project description
๐ฏ What is FlakeRadar?
FlakeRadar is an intelligent test analysis platform that transforms raw test results into actionable insights. It combines statistical analysis, AI-powered root cause detection, and time-tracking analytics to help engineering teams eliminate flaky tests and improve CI/CD reliability.
"The GitHub Copilot for Test Quality" - Identify, prioritize, and fix unreliable tests with enterprise-grade analytics.
๐ฅ Key Problems Solved
| Problem | FlakeRadar Solution |
|---|---|
| ๐จ False Flaky Alerts | Statistical confidence scoring (Wilson intervals) |
| โฑ๏ธ Unknown Fix Priority | Time-to-fix tracking & productivity impact analysis |
| ๐ Manual Root Cause Analysis | AI-powered pattern recognition & clustering |
| ๐ Lack of Metrics | Enterprise dashboards with trend analysis |
| ๐ฏ No Actionable Insights | Specific recommendations per failure type |
๐ Quick Start
Installation
# Clone the repository
git clone https://github.com/your-repo/flakeradar.git
cd flakeradar
# Install dependencies
pip install -e .
# Optional: Enable AI analysis (requires OpenAI API key)
export OPENAI_API_KEY="your-api-key-here"
Basic Usage
# Analyze test results
flakeradar --project "MyApp" --results "test-results/*.xml"
# View beautiful HTML report
open flakeradar_report.html
Sample Output
๐จ Worst Flaky Test Offenders (Time-to-Fix Analysis):
๐
DatabaseTest#connectionPool: 14 days flaky, 45 failures (Still Flaky)
๐
AuthTest#tokenRefresh: 7 days flaky, 23 failures (Still Flaky)
๐ Root Cause Clustering Analysis:
๐ด database_connectivity: 15 failures, 8 tests affected
๐ก ๐๏ธ Database: Check connection pool settings, network connectivity
๐ timing_race_conditions: 8 failures, 4 tests affected
๐ก โฑ๏ธ Timing: Add proper waits, review async operations
๐ค Analyzing 12 failing tests with AI...
โ
AI analysis complete
๐ Enterprise Features
1. ๐ฏ Statistical Confidence Scoring
FlakeRadar uses advanced statistical analysis to eliminate false positives:
- Wilson Score Intervals: Industry-standard confidence calculation (95% CI)
- Transition Analysis: True flaky tests change states (passโfailโpass)
- Sample Size Considerations: Minimum thresholds prevent unreliable classifications
- Confidence Threshold: Only tests with 70%+ confidence marked as flaky
# Example: High confidence flaky test
Test: UserLoginTest#validateCredentials
โโโ Sample Size: 20 runs (100% confidence factor)
โโโ Transitions: 8 state changes (84% confidence factor)
โโโ Wilson Score: Narrow interval around 40% (90% confidence)
โโโ Final Confidence: 76% โ
(Marked as flaky)
2. โฑ๏ธ Time-to-Fix Analytics
Track productivity impact with sophisticated lifecycle monitoring:
- Flaky Test Lifecycle: First detected โ Duration flaky โ Fixed timestamp
- Worst Offenders: Tests consuming most engineering time
- Team Metrics: Average resolution time, fix velocity trends
- Cost Analysis: Engineering hours lost to debugging flaky tests
๐ Time-to-Fix Insights:
โโโ Average Resolution: 5.2 days
โโโ Productivity Cost: 12 hours/week debugging
โโโ Worst Offender: DatabaseTest (21 days flaky, $3,200 cost)
โโโ Trend: 40% improvement in resolution time this month
3. ๐ง AI-Powered Root Cause Analysis
Intelligent pattern recognition clusters failures by actual root causes:
๐ Root Cause Categories:
โโโ ๐๏ธ Database Connectivity (connection, pool, timeout)
โโโ ๐ Network/API Issues (http, socket, unreachable)
โโโ โฑ๏ธ Timing/Race Conditions (async, thread, wait)
โโโ ๐พ Resource Constraints (memory, disk, cpu)
โโโ ๐ Auth/Permission Issues (token, credential, forbidden)
โโโ ๐ Data/State Issues (null, missing, invalid)
โโโ โ๏ธ Environment/Config (variables, settings, properties)
Smart Recommendations:
- Fix one database issue โ resolve 8 test failures
- Targeted guidance per cluster type
- Severity scoring based on impact scope
4. ๐ Beautiful Analytics Dashboard
Professional HTML reports with interactive visualizations:
- ๐ Executive Summary: Key metrics, confidence scores, trend analysis
- ๐ Flakiness Trend Line: Visual representation sorted by severity
- โฑ๏ธ Time-to-Fix Tables: Chronic issues requiring immediate attention
- ๐ Root Cause Matrix: Clustered failures with actionable recommendations
- ๐ฏ Priority Indicators: Color-coded urgency levels
๐ง Advanced Configuration
Supported Test Frameworks
| Framework | Status | File Formats |
|---|---|---|
| JUnit | โ Supported | *.xml |
| TestNG | โ Supported | *.xml |
| Pytest | ๐ง Coming Soon | junit.xml |
| Jest | ๐ง Coming Soon | *.xml |
Configuration Options
# Full command options
flakeradar \
--project "MyApp" # Project identifier
--results "tests/**/*.xml" # Test result glob pattern
--mode local # Analysis mode (local/push)
--build "build-123" # CI build identifier
--commit "abc123" # Git commit SHA
--report-out "custom-report.html" # Output file path
Environment Variables
# Enable AI-powered analysis (optional)
export OPENAI_API_KEY="sk-..."
# Custom database location
export FLAKERADAR_DB_PATH="/custom/path/flakeradar.db"
# Disable external API calls
unset OPENAI_API_KEY
๐๏ธ Architecture & Data Flow
graph LR
A[Test Results] --> B[Parser Engine]
B --> C[Statistical Analysis]
C --> D[Flakiness Detection]
D --> E[Root Cause Clustering]
E --> F[AI Analysis]
F --> G[Time Tracking]
G --> H[Priority Scoring]
H --> I[Beautiful Reports]
J[SQLite Database] --> C
K[OpenAI API] --> F
L[Historical Data] --> G
Core Components
| Component | Purpose | Technology |
|---|---|---|
| Parser Engine | Multi-format test result parsing | lxml, xml.etree |
| Statistical Engine | Confidence scoring, Wilson intervals | math, custom algorithms |
| AI Analysis | Root cause suggestions | OpenAI GPT-4o-mini |
| Database Layer | Historical tracking, lifecycle management | SQLite, time-series data |
| Report Engine | Interactive dashboards | Jinja2, Chart.js, modern CSS |
๐ Priority Decision Matrix
FlakeRadar uses multi-layered priority intelligence to help teams focus on high-impact fixes:
๐ฆ Visual Priority (Flake Rate)
- ๐ด High: >50% flake rate (deployment blockers)
- ๐ Medium: 20-50% flake rate (reliability concerns)
- ๐ข Low: <20% flake rate (stable tests)
โฑ๏ธ Time-to-Fix Priority
- ๐ด Critical: >7 days flaky (chronic productivity killers)
- ๐ High: 3-7 days flaky (emerging issues)
- ๐ข Medium: <3 days flaky (new problems)
๐ Root Cause Severity
- ๐ด Critical: 5+ tests affected, 10+ failures (infrastructure crisis)
- ๐ High: 3+ tests affected, 5+ failures (significant pattern)
- ๐ก Medium: 2+ tests affected OR 3+ failures (emerging pattern)
๐ฏ Use Cases & ROI
For Engineering Managers
๐ Metrics Dashboard:
โโโ Test reliability improved 75%
โโโ CI/CD failure rate reduced 60%
โโโ Engineering time saved: 15 hours/week
โโโ Mean time to resolution: 3.2 days โ 1.8 days
For QA Engineers
๐ Smart Analysis:
โโโ AI-powered failure categorization
โโโ Statistical confidence prevents false alerts
โโโ Actionable recommendations per failure type
โโโ Historical trend analysis for pattern recognition
For DevOps Teams
๐๏ธ Infrastructure Insights:
โโโ Database connectivity issues affecting 8 tests
โโโ Network timeout patterns in staging environment
โโโ Resource constraint analysis (memory, CPU, disk)
โโโ Environment configuration drift detection
๐ CI/CD Integration
GitHub Actions
name: FlakeRadar Analysis
on: [push, pull_request]
jobs:
flake-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Tests
run: mvn test
- name: Analyze Flakiness
run: |
pip install flakeradar
flakeradar --project "${{ github.repository }}" \
--results "target/surefire-reports/*.xml" \
--build "${{ github.run_number }}" \
--commit "${{ github.sha }}"
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- name: Upload Report
uses: actions/upload-artifact@v3
with:
name: flakeradar-report
path: flakeradar_report.html
Jenkins Pipeline
pipeline {
agent any
stages {
stage('Test Analysis') {
steps {
sh 'mvn test'
sh '''
pip install flakeradar
flakeradar --project "${JOB_NAME}" \
--results "target/surefire-reports/*.xml" \
--build "${BUILD_NUMBER}" \
--commit "${GIT_COMMIT}"
'''
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: '.',
reportFiles: 'flakeradar_report.html',
reportName: 'FlakeRadar Report'
])
}
}
}
}
๐ API Reference
Command Line Interface
flakeradar [OPTIONS]
Options:
--project TEXT Project name identifier [required]
--results TEXT Glob pattern for test result files [required]
--logs TEXT Glob pattern for log files (future feature)
--mode TEXT Analysis mode: local|push [default: local]
--build TEXT CI build identifier [default: local-build]
--commit TEXT Git commit SHA [default: local]
--report-out TEXT HTML report output path [default: flakeradar_report.html]
--help Show this message and exit
Python API
from flakeradar import FlakeRadar
# Initialize analyzer
radar = FlakeRadar(project="MyApp")
# Add test results
radar.add_results("test-results/*.xml")
# Analyze flakiness
analysis = radar.analyze(
confidence_threshold=0.7,
enable_ai=True,
track_time_to_fix=True
)
# Generate reports
radar.generate_html_report("report.html")
radar.export_metrics("metrics.json")
๐ Security & Privacy
Data Handling
- Local Storage: All analysis data stored locally in SQLite database
- Optional AI: OpenAI integration requires explicit API key configuration
- No Data Upload: Test results never leave your infrastructure (local mode)
- Audit Trail: All API calls logged with timestamps and error details
API Usage Transparency
๐ค AI Analysis Status:
โโโ API Calls Made: 5
โโโ Tests Analyzed: 12 failing tests
โโโ Tokens Used: ~1,200 (estimated cost: $0.03)
โโโ Success Rate: 100%
โโโ Privacy: Error messages sanitized, no source code sent
๐ค Contributing
We welcome contributions! FlakeRadar is designed to be extensible and enterprise-ready.
Development Setup
# Clone repository
git clone https://github.com/your-repo/flakeradar.git
cd flakeradar
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run with sample data
flakeradar --project "FlakeRadar" --results "src/flakeradar/sample_results/*.xml"
Architecture Extensibility
# Add new test result parsers
class CustomParser(BaseParser):
def parse(self, file_path: str) -> List[TestCaseResult]:
# Custom parsing logic
pass
# Add new root cause patterns
class CustomClusterAnalyzer(BaseClusterAnalyzer):
def extract_signature(self, result: TestCaseResult) -> str:
# Custom pattern matching
pass
# Add new AI providers
class CustomAIProvider(BaseAIProvider):
def analyze_failure(self, error_details: str) -> str:
# Custom AI analysis
pass
Roadmap
- Pytest Support: Native pytest result parsing
- Jest Integration: JavaScript test framework support
- Slack/Teams Integration: Real-time flaky test notifications
- JIRA Integration: Automatic ticket creation for chronic issues
- GitHub PR Comments: Flake risk assessment before merge
- PostgreSQL Backend: Enterprise-scale data storage
- REST API: Programmatic access to all features
- Docker Images: Containerized deployment options
License
FlakeRadar is licensed under the MIT License. See LICENSE for full details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flakeradar-1.0.1.tar.gz.
File metadata
- Download URL: flakeradar-1.0.1.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45aa9e20c9a0ecabae64e48acbf840aadc814f72753fec90027f6170ba133888
|
|
| MD5 |
593c74becd871d2b4fe131627787797c
|
|
| BLAKE2b-256 |
7f7347cb653c18e9db373214c243da33730950380e92c32d4e3cd6d67e1cfb15
|
File details
Details for the file flakeradar-1.0.1-py3-none-any.whl.
File metadata
- Download URL: flakeradar-1.0.1-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2791e0ec2157d43ed9c50b2a3d83c7eef6f850b8f70814ca49a11c956583cfc3
|
|
| MD5 |
4bb49860abe9e06468e07903e5381e6f
|
|
| BLAKE2b-256 |
bbd40927b57bc87cd6e0edffa8868904fd36d40cac90869183bc2c3e638f74f6
|