I want to see the names of all failed tests in email body when an email is triggered by jenkins using editable email notification plugin.
I am using TestNg with selenium+java.
I want to see the names of all failed tests in email body when an email is triggered by jenkins using editable email notification plugin.
I am using TestNg with selenium+java.
You can add allure reports in your tests and send the allure links or file via emial as in code below:
stage('Create properties file for allure') {
steps {
sh '''
export CHATBOT_ENV
touch allure-results/environment.properties
'''
}
}
stage('Allure reports') {
steps {
script {
allure([
includeProperties: true,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'allure-results/']]
])
}
}
}
}
post
{
always
{
echo 'This will always run'
emailext body: "Build URL: ${BUILD_URL}",
attachmentsPattern: "**/path_to_your_report",
subject: "$currentBuild.currentResult-$JOB_NAME",
to: 'nobody@optum.com'
}
}
}
THe build URL can be used to navigate to allure report.