Jenkins
Connect FixSense to your Jenkins pipelines for automated test failure analysis.
Overview
FixSense supports Jenkins alongside GitHub Actions, GitLab CI, Azure Pipelines, and Bitbucket Pipelines. When tests fail in your Jenkins pipeline, FixSense analyzes the JUnit XML results and provides AI-powered root cause analysis.
Quick Setup
Add a post-build step to your Jenkinsfile that sends test results to FixSense:
pipeline {
agent any
stages {
stage('Test') {
steps {
sh 'npm ci'
sh 'npx playwright test --reporter=junit --output-file=test-results/results.xml || true'
}
post {
always {
junit 'test-results/*.xml'
}
}
}
stage('FixSense Analysis') {
when { expression { currentBuild.result == 'UNSTABLE' || currentBuild.result == 'FAILURE' } }
steps {
sh '''
curl -sS -X POST "https://fix-sense.com/api/v1/analyze" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${FIXSENSE_API_KEY}" \
-d "$(node -e "
const fs = require('fs');
const path = require('path');
const files = fs.readdirSync('test-results').filter(f => f.endsWith('.xml'));
const failures = [];
for (const file of files) {
const content = fs.readFileSync(path.join('test-results', file), 'utf-8');
failures.push({ name: file, content: Buffer.from(content).toString('base64') });
}
console.log(JSON.stringify({
repo: '${JOB_NAME}',
runId: '${BUILD_NUMBER}',
rawFiles: failures
}));
")"
'''
}
}
}
}Using Docker (Alternative)
If your Jenkins agents have Docker, you can use the FixSense pipe image:
stage('FixSense Analysis') {
when { expression { currentBuild.result != 'SUCCESS' } }
steps {
sh '''
docker run --rm \
-v $(pwd)/test-results:/test-results \
-e FIXSENSE_API_KEY=${FIXSENSE_API_KEY} \
-e RESULTS_PATH="test-results/**" \
-e BITBUCKET_REPO_FULL_NAME=${JOB_NAME} \
-e BITBUCKET_BUILD_NUMBER=${BUILD_NUMBER} \
sgace11/fixsense-pipe:latest
'''
}
}Setup
Step 1: Get your API key
- Sign in at fix-sense.com
- Go to Settings
- Copy your API key
Step 2: Add API key to Jenkins
- Go to Manage Jenkins → Credentials
- Add a Secret text credential
- ID:
FIXSENSE_API_KEY - Secret: paste your API key
Step 3: Reference in Jenkinsfile
environment {
FIXSENSE_API_KEY = credentials('FIXSENSE_API_KEY')
}Supported Test Frameworks
Any framework that produces JUnit XML reports works with Jenkins + FixSense:
- Playwright —
['junit', { outputFile: 'test-results/results.xml' }] - Cypress —
cypress-junit-reporter - Jest —
jest-junit - pytest —
--junitxml=test-results/results.xml - JUnit/TestNG — Native JUnit XML output
- NUnit/xUnit —
dotnet test --logger "junit" - .NET TRX — FixSense parses TRX natively
What You Get
For each failing test, FixSense provides on your dashboard:
- Root Cause — AI-powered explanation of why the test failed
- App Bug vs Test Bug — classification of the failure source
- Flakiness Score — 0-100 indicating likelihood of flaky behavior
- Suggested Fix — actionable steps to resolve the failure
Limitations
Jenkins integration uses the FixSense API directly (no webhook). This means:
| Feature | Jenkins Support |
|---|---|
| AI failure analysis | Yes |
| Flakiness scoring | Yes |
| Dashboard | Yes |
| PR comments | Not yet — roadmap |
| Auto-fix agent | Not yet — roadmap |
| Quality gates | Not yet — roadmap |
For full auto-fix and PR comment support, consider using GitHub Actions, GitLab CI, Azure Pipelines, or Bitbucket Pipelines.
Troubleshooting
No analyses appear after build failure
- Check that your
Jenkinsfileproduces JUnit XML intest-results/ - Verify
FIXSENSE_API_KEYcredential is set correctly - Check the post-build step runs only on failure (
whencondition) - Check Jenkins console output for curl errors
"Unauthorized" error from API
Verify your API key is correct and hasn't expired. Get a new key from dashboard settings.