Reputation: 65
I am using Jenkins to pull my automation code for website from github repository and then when builds finished I am receiving the email with details like project url,status ,duration.
What I want is that this email should show the below
Total tests count Pass tests count Failed tests count Skip tests count Failed tests name if any
Platform: I am using selenium to automate my website and testng with extent reporting
Upvotes: 0
Views: 4143
Reputation: 31
For getting the count of Passed
, Failed
, Skipped
, make sure you are publishing the TestNG Results under Post-build Actions (using TestNG plugin)
After that use Token Macro Plugin Tokens i.e ${TEST_COUNTS,var="pass"} ${TEST_COUNTS,var="fail"} ${TEST_COUNTS,var="skip"}
, to get the test count
Upvotes: 3
Reputation: 3356
You can use inbuilt email template which will send you the details of the tests. Below is the example of pipeline:
post {
always {
emailext body: ''
'${SCRIPT, template="groovy-html.template"}'
'',
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - Successful",
mimeType: 'text/html', to: "email list"
}
}
This template is using JUnit, you can check the code in template and modify it for testNG or selenium.
Upvotes: 1