I know it's weeks since this was asked, but I suppose it can't hurt to add
some information. This problem is
https://issues.jenkins-ci.org/browse/JENKINS-27395

I'm using this kludge inside Jenkinsfile (where 'appserver' is used to
namespace the test results):

def integrationTests(def appserver) {
  sh "./mvnw verify"
  def testFiles = '**/target/failsafe-reports/TEST-*.xml'
  setJUnitPrefix(appserver, testFiles)
  junit testFiles
}

// from
https://issues.jenkins-ci.org/browse/JENKINS-27395?focusedCommentId=256459&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-256459
def setJUnitPrefix(prefix, files) {
  // add prefix to qualified classname
  sh "shopt -s globstar && sed -i \"s/\\(<testcase
.*classname=['\\\"]\\)\\([a-z]\\)/\\1${prefix.toUpperCase()}.\\2/g\" $files"
}

Naturally, a regex is a terrible way of parsing XML, but the idea of the
sed script is to add the prefix to every classname attribute inside a
testcase element (<testcase classname=""). I'm using failsafe's filenames
here, but the general idea should work for any junit xml file, as long as
classname is the first attribute in the testcase element, and on the same
line. (The regex could be a little simpler, but I wanted the processing to
be idempotent.)

As an example, the wildfly results for org.example.ExampleTest now appear
in Jenkins as WILDFLY.org.example.ExampleTest, separated from
JBOSSEAP.org.example.ExampleTest.



On 18 August 2016 at 12:51, Joshua Harlow <harlo...@gmail.com> wrote:

> Hi,
>
> I am working through creating a jenkinsfile (and/or equivalent) for the
> openstack (nova) project we are using at godaddy,
>
> The stages are broken up into (literally the following):
>
> stage("Initiation")
> flows = build()
> node {
>     start {
>         net_info()
>     }
> }
>
> stage("Checkout")
> slack_stage(
>     "Checking out (and stashing) repo for ${project}",
>     {
>         parallel(flows["cloners"])
>     }
> )
>
> stage("Patch fetching")
> slack_stage(
>     "Checking out (internal) patch repo and stashing patches for
> ${project}",
>     {
>         parallel(flows['patch_getters'])
>     }
> )
>
> stage("Unmodified (unit) testing")
> slack_stage(
>     "Unit testing unmodified ${project}",
>     {
>         parallel(flows["testers"])
>     }
> )
>
> stage("Augmentation")
> slack_stage(
>     "Augmenting ${project}",
>     {
>         parallel(flows["augmenters"])
>     }
> )
>
> stage("Modified (unit) testing")
> slack_stage(
>     "Unit testing modified ${project}",
>     {
>         parallel(flows["post_testers"])
>     }
> )
>
> stage("Finished")
> finish()
>
>
> The unmodified testing there will publish before-patch unit test results
> and the post-patch modification will also publish another set of unit test
> results,
>
> When this happens it seems like jenkins only shows the first and not both
> sets of unit test results; is there a plugin that would make both show up?
>
> For recording I am using the following:
>
>  step([$class: 'JUnitResultArchiver',
> testResults: 'results.xml', allowEmptyResults: true])
>
> Maybe there is something special people are doing in groovy to make it
> work,
>
> Tips would be appreciated :)
>
> -Josh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/ba6d8e88-a84b-491f-946a-37cc6a57aeaa%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/ba6d8e88-a84b-491f-946a-37cc6a57aeaa%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAGi586PhMB7bJ9J0t2LQhRA7UL2Xinz0V6NqXT0ENtBmvy4GhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to