How to submit a unit test graph in a Jenkins report via email?

I use Jenkins to run our unit tests and send emails to developers. I am using Jelly Script to include pass / fail results in an email. However, I would also like to include the pass / fail graph, which will be provided to you after the test build is complete. In the end, this is the chart we are interested in, isn't it? :)

+4
source share
2 answers

if your mail is in html format, than you can access the image through this URL:

[JENKINS_URL] / Work / [JOB_NAME] / test / trend

+2
source
By the way, a very useful question. No one is currently reading :) In any case, from a psychological point of view, it is really better to use a graphical form, so there are several ways to achieve this.

Solution # 1 - Put a link or link

It's easy to put a link or image tag with the correct URL (the one suggested by Shurik), but you must make Jenkins public so your recipients can see the image. Incidentally, a rather dangerous approach.

Solution # 2 - Download Image

Upload the image to a public image hosting service and complete Solution # 1.

Solution # 3 - Attach Image

The idea is to put the encoded image in a separate email section. Jenkins will generate the image (it can be accessed at the URL), so you can encode it and include it in your mail. Details and example:

enter image description here

+1
source

Source: https://habr.com/ru/post/1445713/


All Articles