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

Gradle CI builds fail when no test tasks are run

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • gradle-plugin
    • None
    • Linux

      We have a gradle build with multiple subprojects.
      Gradle can check what has been build previously and will not build again if nothing changed.

      Now when changing a minor thing in the tree (like a properties file) the build will start to run, notices everyting is up to date and will not start compiling/testing/jar-ing

      But at the end of the build Jenkins says: Test reports were found but none of them are new. Did tests run?
      My answer is: no, because there was no use.

      How do I take care of this issue?

          [JENKINS-9438] Gradle CI builds fail when no test tasks are run

          Stig Kleppe-Jørgensen added a comment - - edited

          You can do as described here:

          http://www.practicalgradle.org/blog/2011/06/incremental-tests-with-jenkins/

          Or maybe vote for the duplicated issue?

          Stig Kleppe-Jørgensen added a comment - - edited You can do as described here: http://www.practicalgradle.org/blog/2011/06/incremental-tests-with-jenkins/ Or maybe vote for the duplicated issue?

          Wolfgang S added a comment -

          The workaround described above is a very poor solution for Gradle builds since it tampers with the outputs of the test task. Further it adds the necessity to find out if we're running on Jenkins or a local dev build.

          We're currently trying to migrate an existing Gradle CI build to Jenkins pipeline. To workaround this issue we have so far used the xUnit-Plugin which is more Gradle-friendly. With Pipeline we're not able to use xUnit anymore. Not being able to record test results is pretty much a show stopper.

          Please make this behaviour configurable since it doesn't align with modern build systems.

          Wolfgang S added a comment - The workaround described above is a very poor solution for Gradle builds since it tampers with the outputs of the test task. Further it adds the necessity to find out if we're running on Jenkins or a local dev build. We're currently trying to migrate an existing Gradle CI build to Jenkins pipeline. To workaround this issue we have so far used the xUnit-Plugin which is more Gradle-friendly. With Pipeline we're not able to use xUnit anymore. Not being able to record test results is pretty much a show stopper. Please make this behaviour configurable since it doesn't align with modern build systems.

          Wolfgang S added a comment -

          Just found out that I actually can use xUnit plugin from Pipeline script. For anyone using Gradle and Pipeline, you can use "General build step" to have xUnit collect test results:

          step([$class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '20', unstableNewThreshold: '1', unstableThreshold: '0'], [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']], tools: [[$class: 'JUnitType', deleteOutputFiles: true, failIfNotNew: false, pattern: '**/build/test-results/*.xml', skipNoTestFiles: true, stopProcessingIfError: true]]])
          

          Wolfgang S added a comment - Just found out that I actually can use xUnit plugin from Pipeline script. For anyone using Gradle and Pipeline, you can use "General build step" to have xUnit collect test results: step([$class: 'XUnitBuilder' , testTimeMargin: '3000' , thresholdMode: 1, thresholds: [[$class: 'FailedThreshold' , failureNewThreshold: '', failureThreshold: ' 20 ', unstableNewThreshold: ' 1 ', unstableThreshold: ' 0 '], [$class: ' SkippedThreshold ', failureNewThreshold: ' ', failureThreshold: ' ', unstableNewThreshold: ' ', unstableThreshold: ' ']], tools: [[$class: ' JUnitType ', deleteOutputFiles: true , failIfNotNew: false , pattern: ' **/build/test-results/*.xml', skipNoTestFiles: true , stopProcessingIfError: true ]]])

          Stefan Wolf added a comment -

          Closing this issue as a duplicate. I think the problem should be fixed on the junit plugin side. The xUnit plugin already seems to fix this.

          Stefan Wolf added a comment - Closing this issue as a duplicate. I think the problem should be fixed on the junit plugin side. The xUnit plugin already seems to fix this.

            gbois Gregory Boissinot
            bjansen bjansen
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: