Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include test summary in build notifications #25

Merged
merged 3 commits into from Feb 1, 2015

Conversation

randomsync
Copy link
Contributor

Include test summary in build notification. A checkbox is added to build settings page which can be used to specify whether to include test summary or not. If enabled and no tests are found, a "No Tests found" message is appended.

screenshot from 2014-10-19 21 03 55

The checkbox is shown along with other options in the build configuration
page. If selected, the test summary will be shown in build notifications.
When sending the 'started' notification, no test summary needs to be
included.
@randomsync randomsync changed the title Feature/test summary Include test summary in build notifications Oct 20, 2014
@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@samrocketman
Copy link
Member

I guess I'll start maintaining this plugin. I don't have any experience developing Jenkins plugins but if I can get my own environment set up and learn to release then I'll do it. This may take about a week.

@samrocketman
Copy link
Member

Candidate for merge means I will first merge your change locally, compile locally, and test locally in Jenkins before merging.

@samrocketman
Copy link
Member

@randomsync I can't seem to be able to produce output from the build. I didn't have an issue with the merge conflicts.

Can you perhaps explain to me how to publish test results in a Job in order to make this feature execute? So far I've tried Publish JUnit test report but I can't seem to get a summary out of it.

@samrocketman
Copy link
Member

Never mind haha, I didn't have the checkbox to publish results checked in the job configuration.

@samrocketman samrocketman merged commit 8905eaf into jenkinsci:master Feb 1, 2015
samrocketman added a commit that referenced this pull request Feb 1, 2015
notifications.  Converted dos2unix line endings in ActiveNotifier.java.

Resolved Conflicts:
	src/main/java/jenkins/plugins/slack/ActiveNotifier.java
	src/main/java/jenkins/plugins/slack/SlackNotifier.java
@randomsync
Copy link
Contributor Author

Thanks @samrocketman

@samrocketman
Copy link
Member

You're welcome.

@randomsync randomsync deleted the feature/test-summary branch February 2, 2015 19:08
@samrocketman
Copy link
Member

I'll be moving include test summary into the advanced section (it will be at the bottom). That's where you'll find your setting in the next release.

@samrocketman samrocketman modified the milestone: slack-1.7 Feb 4, 2015
@samrocketman samrocketman mentioned this pull request Feb 4, 2015
samrocketman added a commit that referenced this pull request Feb 10, 2015
New features:

* Advanced settings
  * Team domain and token can be specified per project; falls back to
    global config if not specified (#19)
  * Post a list of commits with the build notification (title and author
    of commit) (#30, #44, #45)
  * Include JUnit test summary in build notifications (#25)
* Use colors when sending a message using slack (#20, #24).  Also, the
  start notifications use the color of the last build result (#43)
* Support for authenticated proxies (#14)
* Test Connection button (#46, #28)
* Option to disable subsequent notifications on build failures (#46, #15)

Improvements:

* Report 'return to normal' on transition from unstable to success (#21)
* Improved logging.

Bug fixes:

* When changing the global slack settings the slack config in jobs are
  updated as well (#26, #12)
* Fix NullPointerException and output log message if slack is not
  configured (#35, JENKINS-26066)
@johnjohndoe
Copy link

johnjohndoe commented Nov 10, 2016

Could you please tell me if Jenkins ver. 1.651.3 is capable of producing a summary for JUnit tests as shown on the screenshot in the first post of this issue?
I would like to send them to Slack using the Slack plugin.

@fastsieg
Copy link

I'm using rspec for my Ruby project, so I get a no Test found message. It would be nice if one could choose what kind of tests are beeing done.
What also could be a problem is that I run my tests inside a docker container. I don't know if the test results are accessable to the plugin then.

@samrocketman
Copy link
Member

samrocketman commented Nov 13, 2016

fastsieg, that's more a limitation in Jenkins than this plugin. JUnit-style tests are what Jenkins collects. If you run your tests inside of a container then perhaps you should use docker to retrieve the results (or specify a volume if docker is running on the same machine as the Jenkins agent).

@randomsync
Copy link
Contributor Author

@fastsieg also, you can add rspec_junit_formatter to your Gemfile to produce the junit style report.

@remeltucker
Copy link

Using xcpretty to parse the output from xcodebuild as Junit.The test results analyser plugin works fine since it depends on the junit results but the test summary and custom message for slack is not getting posted. Any thoughts ?

@dhiltonp
Copy link

For the result summary to work, you need to have a compatible xml file, which is then fed into the Post-build action of "Publish JUnit test result report".

Once that's working, the jenkins slack bot will have access to the test results to provide a summary.

@johnjohndoe
Copy link

Where can I find out about how the "compatible xml file" has to look like and how to generate it?

@samrocketman
Copy link
Member

@johnjohndoe
Copy link

For my understanding: this manual configuration file is only needed with Jenkins 1.6? The current version of Jenkins automatically outputs test summaries?

@samrocketman
Copy link
Member

Not sure what you mean. It's just JUnit. As far as I know, without additional plugins the test summary comes from JUnit. That is not specific to a particular version of Jenkins.

@johnjohndoe
Copy link

johnjohndoe commented May 9, 2017

Finally, I found out that the path to look for Test report XMLs must be entered in the Publish JUnit test result report action as shown in the screenshot. For my Android project which comes with multiple Gradle product flavors the following path works:

**/build/test-results/**/TEST-*.xml

junit-plugin

@Prasannajnaeyulu
Copy link

Prasannajnaeyulu commented Nov 5, 2018

For the result summary to work, you need to have a compatible xml file, which is then fed into the Post-build action of "Publish JUnit test result report".

Once that's working, the jenkins slack bot will have access to the test results to provide a summary.

This is shown as an example in the previous comment

@bitsydarel
Copy link

How to publish junit report in jenkins declarative pipeline ?

@bitsydarel
Copy link

or where to find the include test summary checkbox...

@swanandvg
Copy link

@bitsydarel
You have to cd to directory where result.xml is stored and then use-
junit "*.xml"

if xml file is new one, then only it will publish result to Jenkins. If result is not new, and still if you want to publish results, modify last modified datetime for xmls-

script {
def testResults = findFiles(glob: '*.xml')
for(xml in testResults) {
touch xml.getPath()
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants