Should I use xUnitPublisher or xUnitBuilder after building xunit.xml files?
From log: WARNING: XUnitBuilder step is deprecated since 2.x, it has been replaced by XUnitPublisher. This builer will be remove in version 3.x So the answer is: use XUnitPublisher, as described on answer 1 above.
After a look at the source code, they seem to be identical in functionality, except XUnitPublisher
has one extra method, the purpose of which I do not understand(!), and the class declares more interfaces in the implements
list.
The crucial difference seems to be that XUnitPublisher
class extends the hudson.tasks.Recorder
class, while XUnitBuilder
extends the hudson.tasks.Builder
.
I believe the user-facing difference is that a failure in a builder marks the Jenkins job as "failed", while failure in a publisher marks the job as "unstable". (source: https://wiki.jenkins.io/display/JENKINS/Terminology)
Given all this, I'd recommend going with xUnitPublisher. I set up my build command to return 0 if compilation passed but some tests failed. This way, Jenkins gives me a FAILED status for broken compilation and UNSTABLE status for working compilation but failing tests. I like it this way.
Commit history does not explain why there is this ridiculous duplication of code. I'd understand if one was implemented in terms of the other, as is usually done when deprecating... Probably because each has to have a different superclass.
XUnitBuilder.java, XUnitPublisher.java