Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37443

Publish hangs for xUnit Plugin for (NUnit test report) in multiple-pipeline

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • xunit-plugin
    • None
    • Jenkins version: 2.7.2
      XUnit Plugin version: 1.102
      JUnit Plugin version: 1.18

      Environment: Windows Server 2008 R2 Standard

      Jenkins hangs when trying to publish an NUnit testresult in a multiple pipeline project.
      To fix the problem I have to kill the java process and restart jenkins (it just consumes more and more memory.

      My pipeline (JenkinsFile) is configured as:

      stage 'Build'
        // Build is done here (through msbuild)
        // Tests are run here which generates "UnitTests_TestResults_NUnit.xml"
      
      stage 'Publish test results in NUnit format'
        step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1,
          tools: [[$class: 'NUnitJunitHudsonTestType', deleteOutputFiles: true, 
          failIfNotNew: true, pattern: '**/*TestResults_NUnit.xml',
          skipNoTestFiles: false, stopProcessingIfError: true]]])
      

      The attached XML file was generated by xUnit.net with the /nunit option set.

      I also tried to publish a xunit.net testreport - it fails in the same way:

      stage 'Build'
        // Build is done here (through msbuild)
        // Tests are run here which generates "UnitTests_TestResults_NUnit.xml"
      
      stage 'Publish test results in XUnit.Net format'
        step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1, 
          tools: [[$class: 'XUnitDotNetTestType', deleteOutputFiles: false, 
          failIfNotNew: true, pattern: '**/*_TestResults_XUnit.xml', 
          skipNoTestFiles: false, stopProcessingIfError: true]]])
      

          [JENKINS-37443] Publish hangs for xUnit Plugin for (NUnit test report) in multiple-pipeline

          Jonas Thyregod added a comment - - edited

          A workaound is to convert the XUnit.Net testresult to JUnit testresult format and the use the "Junit pipeline step" directly. It works without any problems

          stage 'Publish test results'
          		junit '**/*_TestResults_JUnit.xml'
          

          I have attached the xslt (see xUnit2ToJUnit.xslt) used to transform the XUnit.Net testresult to JUnit format (no garanties are given!).

          Jonas Thyregod added a comment - - edited A workaound is to convert the XUnit.Net testresult to JUnit testresult format and the use the "Junit pipeline step" directly. It works without any problems stage 'Publish test results' junit '**/*_TestResults_JUnit.xml' I have attached the xslt (see xUnit2ToJUnit.xslt ) used to transform the XUnit.Net testresult to JUnit format (no garanties are given!).

          Sid S added a comment -

          Is that still the recommended route? If so, how do you apply the xslt file for the transform? Looking for the jenkinsfile syntax ...

          Sid S added a comment - Is that still the recommended route? If so, how do you apply the xslt file for the transform? Looking for the jenkinsfile syntax ...

          Sid S added a comment - - edited

          To anyone else reading this, you can install the NUnit Plugin (https://wiki.jenkins-ci.org/display/JENKINS/NUnit+Plugin) inside Jenkins. Then add

          step([$class: 'NUnitPublisher', testResultsPattern: 'build\\TestResult.xml', debug: false, keepJUnitReports: true, skipJUnitArchiver:false, failIfNoResults: true])
          

          Obviously, replace "build\TestResult.xml" with your test file name or search pattern

          Seems it was recently fixed at https://issues.jenkins-ci.org/browse/JENKINS-27618

          Sid S added a comment - - edited To anyone else reading this, you can install the NUnit Plugin ( https://wiki.jenkins-ci.org/display/JENKINS/NUnit+Plugin ) inside Jenkins. Then add step([$class: 'NUnitPublisher', testResultsPattern: 'build\\TestResult.xml', debug: false, keepJUnitReports: true, skipJUnitArchiver:false, failIfNoResults: true]) Obviously, replace "build\TestResult.xml" with your test file name or search pattern Seems it was recently fixed at https://issues.jenkins-ci.org/browse/JENKINS-27618

            nfalco Nikolas Falco
            joth Jonas Thyregod
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: