Including TestNG Reports within the Jenkins Email Notifications.

Hi All,

This post mainly is for those who have Selenium scripts running as part of their Jenkins Jobs & want to include these results within the main body of the Jenkins Emailable Notification.


1.For the Post Build Actions > Select Editable Email Notifications

2.If this option is not there as part of post build actions, the email-ext-plugin is needed to be installed on Jenkins. Go to

3.Select Content Type as HTML(text/plain)

4.In the Default Content section : remove $DEFAULT_CONTENT.Place the following code to inject your html report into the default content :-

${FILE,path=”relative path to html file”}

Eg: ${FILE,path=”MyWorkspace/MyProj/test-output/emailable-report.html”}

This will place the emailable-report.html content in your email body.

5.You can further choose the various trigger points to include the test report i.e on success, test failures (any) , unstable etc.

Hope this is of use to someone struggling out there and landed up here!



6 responses to “Including TestNG Reports within the Jenkins Email Notifications.

  1. I tried same way, But the report is too large, how can we take only required details in email like Total TC, Passed, Failed and Skipped TCs.

    Do you have any idea, How can we do it.


      • HTML does not good look when viewed from Mac OS mainly tho in Windows it appears fine… It depends on the requirement… We wanted a quick way of implementing the reporting aspect and hence I used Surefire… Coz it serves my purpose…
        At the end of the day, as long as the reports send out ‘useful’ information it is acceptable by me.. I do not mind some minor cosmetic problems…


    • Probably you can write a python script which can strip the existing html to the required details… I’ve not tried it… It should be possible…

      I was pretty happy even with the details provided in the report…Coz when the scripts fail it’s important to get the details of the stacktrace… What if the scripts fail…will the reports make sense then with just the basic info??….


  2. Hi VJ
    I am trying the same code provided by you under default content section ${FILE,path=”relative path to html file”}

    but in mail its printing the same thing whatever i added ${FILE,path=”relative path to html file”}

    Please help!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s