chirag25
chirag25

Reputation: 65

How to show total number of tests count with count of pass/fail in jenkins email

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

Answers (2)

Ravi Prakash
Ravi Prakash

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)

enter image description here

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

Amit Nanaware
Amit Nanaware

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

Related Questions