Automatically detects flaky tests in your nightly GitLab CI pipeline β no branch push required.
Flaky tests are the silent killers of QA confidence. A test that passes sometimes and fails sometimes is worse than no test at all β it trains your team to ignore failures.
FlakeSpy fixes that β without touching your main branch.
FlakeSpy connects to your GitLab project using a personal access token, pulls the JUnit XML artifacts from your nightly CI pipeline automatically every morning, and builds a living picture of your test suite health:
- π Flakiness leaderboard β ranked list of your most unreliable tests
- π 30-night trend chart β pass/fail history + duration over time
- π€ AI root cause classification β timing? locator? data dependency?
- π§ Fix suggestions β specific, actionable advice per flaky test
- π Fully automatic β no CI changes, no push to main, just a GitLab personal token
- π Test detail page β deep dive into any test's full history and AI analysis
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite 5, Axios, Recharts |
| Backend | Java 17, Spring Boot 3.2.3 |
| AI Engine | Groq API (LLaMA 3) |
| Database | PostgreSQL 15 |
| GitLab Integration | GitLab REST API v4 |
| Scheduler | Spring @Scheduled (runs at 6am daily) |
| XML Parsing | JAXB / Java DOM Parser |
| ZIP Extraction | Apache Commons Compress |
| Build | Maven |
flakespy/
βββ backend/
β βββ src/main/java/com/flakespy/
β β βββ controller/
β β β βββ GitLabController.java
β β β βββ TestController.java
β β β βββ DashboardController.java
β β βββ service/
β β β βββ GitLabService.java
β β β βββ XmlParserService.java
β β β βββ FlakinessAnalyserService.java
β β β βββ GroqAIService.java
β β β βββ NightlyScheduler.java
β β βββ model/
β β β βββ GitLabProject.java
β β β βββ TestRun.java
β β β βββ TestResult.java
β β βββ repository/
β β β βββ GitLabProjectRepository.java
β β β βββ TestRunRepository.java
β β β βββ TestResultRepository.java
β β βββ dto/
β β β βββ GitLabConnectRequest.java
β β β βββ FlakyTestSummary.java
β β β βββ TestAnalysis.java
β β β βββ DashboardSummary.java
β β βββ config/
β β β βββ CorsConfig.java
β β βββ FlakespyApplication.java
β βββ src/main/resources/
β β βββ application.yml
β β βββ application-local.yml β gitignored, your secrets
β βββ pom.xml
β
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ GitLabConnect.jsx
β β β βββ SuiteHealthBadge.jsx
β β β βββ FlakyLeaderboard.jsx
β β β βββ TrendChart.jsx
β β βββ pages/
β β β βββ Dashboard.jsx
β β β βββ TestDetail.jsx
β β βββ api/
β β β βββ flakespyApi.js
β β βββ App.jsx
β β βββ main.jsx
β β βββ index.css
β βββ package.json
β
βββ .gitignore
βββ README.md
- Java 17+
- Node.js 20+
- PostgreSQL 15+
- Maven 3.8+
- A free Groq API key
- A GitLab personal access token with
read_apiscope
- Log in to GitLab
- Go to Settings β Access Tokens
- Create a token with
read_apiscope - Copy the token β you'll paste it into FlakeSpy on first launch
No admin access needed. No push permissions needed. Read-only is enough.
git clone https://github.com/YOUR_USERNAME/flakespy.git
cd flakespypsql -U your_username -d postgres -c "CREATE DATABASE flakespy;"Create backend/src/main/resources/application-local.yml β this file is gitignored:
DB_USERNAME: your_postgres_username
DB_PASSWORD:
GROQ_API_KEY: your_groq_api_keycd backend
mvn spring-boot:runSpring Boot auto-creates all 3 PostgreSQL tables on first run. Backend starts on http://localhost:8080.
cd frontend
npm install
npm run devFrontend starts on http://localhost:5173.
Open http://localhost:5173 and fill in the connect form:
- GitLab project ID β found in GitLab β Settings β General
- Project name β any display name you choose
- Personal access token β the
read_apitoken you created - CI job name β the job in your
.gitlab-ci.ymlthat produces XML artifacts - GitLab URL β
https://gitlab.comor your self-hosted URL
FlakeSpy immediately pulls your last 30 nightly runs and builds your first flakiness report.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/gitlab/connect |
Connect a GitLab project |
POST |
/api/gitlab/sync/{id} |
Manually trigger artifact pull |
GET |
/api/gitlab/projects |
List connected projects |
DELETE |
/api/gitlab/projects/{id} |
Disconnect a project |
GET |
/api/tests/flaky?projectId=1 |
Flakiness leaderboard |
GET |
/api/tests/{name}/history |
30-night pass/fail history |
GET |
/api/tests/{name}/analysis |
AI root cause + fix suggestion |
GET |
/api/dashboard/summary?projectId=1 |
Suite health summary |
FlakeSpy uses the GitLab REST API v4 β no pipeline changes needed:
GET /api/v4/projects/:id/jobs?scope=success
Authorization: Bearer YOUR_PERSONAL_TOKEN
Then downloads artifacts for each nightly job:
GET /api/v4/projects/:id/jobs/:job_id/artifacts
NightlyScheduler runs this automatically every morning at 6am after your nightly pipeline finishes. You can also trigger a manual sync anytime from the dashboard.
flakiness_score = status_flips / (total_runs - 1)
| Score | Label | Action |
|---|---|---|
| 0.0 β 0.2 | π’ Stable | No action needed |
| 0.2 β 0.5 | π‘ Unstable | Monitor closely |
| 0.5 β 0.8 | π Flaky | Fix soon |
| 0.8 β 1.0 | π΄ Broken | Fix immediately |
| Category | Typical symptom |
|---|---|
TIMING |
TimeoutException, StaleElementException |
LOCATOR |
NoSuchElementException intermittently |
DATA_DEPENDENCY |
Fails after another test, passes in isolation |
NETWORK |
Connection timeouts, session drops |
CONCURRENCY |
Fails in parallel runs only |
ENVIRONMENT |
Fails on specific device/OS only |
- Project setup and architecture
- Spring Boot REST API
- PostgreSQL β 3 tables auto-created
- GitLab API integration
- JUnit XML parser
- Flakiness score algorithm
- Nightly scheduler (6am auto-sync)
- Groq AI root cause classification
- React frontend
- GitLab connect form
- Suite health dashboard
- Flakiness leaderboard with filters
- 30-night trend chart
- Test detail + AI analysis page
- Allure JSON format support
- Email alerts for new broken tests
- Multi-project support
Kevil β QA Engineer learning full-stack development Project 2 of my coding journey | Built from a real pain I face every single night
MIT License
π‘ Part of the QA Tools ecosystem:
- TestGenie AI β AI-powered test case generator