New Feature: Realtime test results for JUnit

1,034 views
Skip to first unread message

oliver gondža

unread,
Aug 8, 2013, 8:18:58 AM8/8/13
to jenkin...@googlegroups.com
Hi,

I have started working on a feature that would allow users to look at
JUnit Test Results while the build is still running. The Test Result page
is updated with new results as they are produced by underlying build until
they are turned into final Test Results as we know them. As it is an
interesting feature and it is considerably easier to do in core than in a
plugin, I will try to get this pulled into core soon.

Our users found such a feature extremely useful as they work with build
running for hours. This was actually a part of the reason why wildfly team
switched from Jenkins CI to TeamCity (for the entire discussion see [1]).

What do you think about such a feature in core?

[1] http://lists.jboss.org/pipermail/wildfly-dev/2013-July/000413.html

--
oliver

Larry Shatzer, Jr.

unread,
Aug 8, 2013, 9:52:11 AM8/8/13
to jenkin...@googlegroups.com




--
oliver

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



ogondza

unread,
Aug 8, 2013, 11:41:26 AM8/8/13
to jenkin...@googlegroups.com
Thanks, never heard about the plugin before. This seems to require assistance from the project being built, right?

I simply rerun JUnitParser to collect report files regardless where did they come from.

Perhaps I'm wrong. I do not have enough time try it out.

--
oliver

Larry Shatzer, Jr.

unread,
Aug 8, 2013, 11:57:28 AM8/8/13
to jenkin...@googlegroups.com
I've not used the plugin, since it does require some extra setup on the project side, such as extra jar, and tests setup with a specific runner, or something like that. You might want to contact the plugin maintainer for more help or information.

-- Larry



--
oliver

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

Kevin Fleming (BLOOMBERG/ 731 LEXIN)

unread,
Aug 8, 2013, 12:00:52 PM8/8/13
to jenkin...@googlegroups.com
Re-executing the JUnitParser is going to be very expensive for builds with a large number of unit tests. When I've considered this sort of thing in the past, I was pretty certain that it would require 'help' from the project itself, so that the parser can be made aware of newly-available test results. Otherwise, you're basically polling, which we all know is evil :-)

Roman

unread,
Aug 8, 2013, 1:30:21 PM8/8/13
to jenkin...@googlegroups.com, ogondza
Hi,
Could you please describe more how do you do it?
I use junit results for non-java tests and and want to see realtime
results feature but Test+In+Progress+Plugin oriented on java events.

Thanks,
Roman
> --
> You received this message because you are subscribed to the Google
> Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jenkinsci-de...@googlegroups.com.

Kohsuke Kawaguchi

unread,
Aug 8, 2013, 11:07:38 PM8/8/13
to jenkin...@googlegroups.com, oliver gondža

I think this is great! It's certainly a long awaited feature.

I agree with Kevin that this would likely eventually require some
changes in JUnitParser for efficiency. But I think it's good thing to do.

What do you think about spending an office hour on topic so that we can
hash out challenges and see if we can rally some people around this effort?
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
Try Jenkins Enterprise, our professional version of Jenkins

ogondza

unread,
Aug 12, 2013, 6:58:29 AM8/12/13
to jenkin...@googlegroups.com
Thanks for the feedback. I guess we agreed that it would be an interesting feature for core provided we can implement it in a reasonably efficient way.

@kpfleming: We can do better than re-runing JUnitResultArchiver. I have modified the parser to update result object incrementally in order _not_ to parse the same report files over and over again. My draft invokes parsing JIT (but it is blocking the UI thread which probably could be eliminated using ajax) so there is no parsing as long as no one wants to see the results. Possible improvement we might be interested in is spinning a thread on slave to monitor new report files and push updates to master when there is something new (no polling on master, no polling over network). I did not find a way to eliminate polling altogether preserving all the flexibility JUnitResultArchiver provides, though.

Testing on remote slave is actually faster than I expected. Refreshing test results takes ~5 seconds when building jenkins.

@Roman: This filesystem based approach will cover your use case as well.

Jesse Glick

unread,
Aug 12, 2013, 10:55:44 AM8/12/13
to jenkin...@googlegroups.com
On Mon, Aug 12, 2013 at 6:58 AM, ogondza <ogo...@gmail.com> wrote:
> it would be an interesting feature for core

Definitely it would, though for something this complex I cannot help
but ask if we should not first make a real effort to split JUnit
reporting out of core into a proper plugin.

> spinning a thread on slave to monitor new report files

Or use java.nio.file.WatchService when available. Most practical when
the report wildcard contains just a single wildcard in the final path
segment, i.e. ‘some-dir/TEST-*.xml’ can be easily monitored by
watching some-dir; in the general case (e.g. ‘**/TEST-*.xml’) you
might need to watch the whole workspace, which is inefficient using
the current API.

Roman

unread,
Aug 12, 2013, 1:06:07 PM8/12/13
to jenkin...@googlegroups.com, ogondza
It will be great.
Could I help in achieving this?
Thanks,
Roman

ogondza

unread,
Aug 16, 2013, 4:48:10 AM8/16/13
to jenkin...@googlegroups.com
I am releasing this plugin to deliver the feature early. In the meantime, someone might find it useful.

ogondza

unread,
Sep 18, 2013, 10:03:58 AM9/18/13
to jenkin...@googlegroups.com
Hi, it's been a while but finally I have something that seems to work for freestyle, maven and matrix projects. I am working on report aggregation so it is sill a work in progress. But the most important part is done: asynchronous test result updating for individual builds.

tl;dr: Every build type provides it's implementation of updater thread that is started early in build and terminated after the build is finished. The thread poll the filesystem, parse new reports found and send it to master if there are any. Reports are merged on master.

This feature is on by default for maven jobs but it needs to be triggered explicitly ("Report test result in realtime") for freestyle and matrix jobs. This inconsistency might be in line with the philosophy of corresponding job types, I am not sure, but it was the easiest thing to do.


--
oliver

ogondza

unread,
Sep 27, 2013, 12:29:32 PM9/27/13
to jenkin...@googlegroups.com
I consider this pull request feature complete. If interested, try it out:

--
oliver
Reply all
Reply to author
Forward
0 new messages