Jenkins and Unit

I read the Jenkins website and its JUnit plugin, and for some reason, something very simple is not easy for me.

Jenkins has an Email-ext plugin to send custom / advanced email notifications whenever the build is done. In these emails, you can post “content tokens,” which are run-time variables that are replaced by dynamic values ​​when creating emails.

One of these tokens is TEST_COUNTS , which allows you to display the number of running JUnit tests or failed tests, etc.

How can I get Jenkins to display this information correctly? Is there a plugin I need, and if so, which one? I have my work on running JUnit and creating an XML report. I guess Jenkins somehow parses the JUnit results from this XML and uses it to provide values ​​to this token.

But on the other hand, I read the “literature” (mailing lists), which seems to suggest that to use this token you need to use Jenkins to run unit tests, not junit Ant from inside your build script.

Can someone clarify this for me and maybe even set out the “order of operations”, what steps do I need to take to be able to use this token?

It would be extremely helpful to get the number of tests in our creation notifications.

+7
source share
2 answers

Your first explanation is correct. You tell Jenkins where to look for JUnit output files, and analyzes them to find out the test results:

Jenkins configuration screenshot http://so.mrozekma.com/jenkins-junit-publish.png

Test results are displayed on every page of the project and assembly, so as long as you see the correct results, you should get the correct token replacements in your emails

+12
source

Add something similar to the content in the Editable Email Notification configuration:

 Total = $TEST_COUNTS Failed = ${TEST_COUNTS,var="fail"} 

I also recommend the Jenkins user mailing list for Jenkins questions, which is usually helpful.

+4
source

All Articles