Reports are useless if nobody looks at them. You run regression at 2 AM. Tests fail. The Allure report sits there, lonely, until someone accidentally opens Jenkins at 11 AM. Nine hours wasted. Notifications fix this. The moment tests fail, your team gets an email or Slack message with a link to the report.
post {
failure {
emailext(
subject: "FAILED: ${env.JOB_NAME} Build #${env.BUILD_NUMBER}",
body: """<html>
<body>
<h2 style="color: red;">Test Execution Failed</h2>
<table border="1" cellpadding="8">
<tr><td><b>Job</b></td><td>${env.JOB_NAME}</td></tr>
<tr><td><b>Build</b></td><td>#${env.BUILD_NUMBER}</td></tr>
<tr><td><b>Branch</b></td><td>${env.GIT_BRANCH}</td></tr>
<tr><td><b>Duration</b></td><td>${currentBuild.durationString}</td></tr>
</table>
<p>
<a href="${env.BUILD_URL}allure">View Allure Report</a> |
<a href="${env.BUILD_URL}console">View Console Log</a>
</p>
</body>
</html>""",
mimeType: 'text/html',
to: 'qa-team@company.com,lead@company.com',
recipientProviders: [
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
]
)
}
unstable {
emailext(
subject: "UNSTABLE: ${env.JOB_NAME} Build #${env.BUILD_NUMBER}",
body: "Some tests failed. Check report: ${env.BUILD_URL}allure",
to: 'qa-team@company.com'
)
}
fixed {
emailext(
subject: "FIXED: ${env.JOB_NAME} Build #${env.BUILD_NUMBER}",
body: "Tests are passing again. Good job!",
to: 'qa-team@company.com'
)
}
}Notice the three triggers: failure sends an alert when tests fail. unstable triggers when some tests fail (yellow status). fixed triggers when a previously failing build passes again — this is a nice touch that tells the team "the bug is fixed, tests are green again."
Many teams prefer Slack over email. Faster, more visible, easier to discuss. Install the "Slack Notification" plugin in Jenkins, then configure it.
post {
failure {
slackSend(
channel: '#qa-automation-alerts',
color: 'danger',
message: """FAILED: ${env.JOB_NAME} #${env.BUILD_NUMBER}
\nBranch: ${env.GIT_BRANCH}
\nReport: ${env.BUILD_URL}allure
\nConsole: ${env.BUILD_URL}console"""
)
}
success {
slackSend(
channel: '#qa-automation-alerts',
color: 'good',
message: "PASSED: ${env.JOB_NAME} #${env.BUILD_NUMBER}"
)
}
}Do NOT send notifications on every successful build. Your team will mute the channel within a day. Send on failure and fixed only. Success notifications are acceptable for nightly regression (once a day) but not for every push.
For Gmail SMTP, you need to generate an "App Password." Regular Gmail passwords do not work with Jenkins. Go to Google Account > Security > 2-Step Verification > App passwords > Generate.
Q: How do you notify the team when CI tests fail?
A: We use the emailext plugin to send HTML emails on failure. The email includes job name, build number, branch, duration, and direct links to the Allure report and console log. We also send to Slack using the Slack Notification plugin for faster visibility. We use three post conditions: failure sends an alert, fixed notifies when the build is green again, and we avoid spamming on every success. The email goes to the QA team and the developer who made the last commit, using DevelopersRecipientProvider.
Key Point: Configure email (emailext) and Slack notifications on failure. Send on failure and fixed — do not spam on every success.