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

Gradle CI builds fail when no test tasks are run

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: gradle-plugin
    • Labels:
      None
    • Environment:
      Linux
    • Similar Issues:

      Description

      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?

        Attachments

          Issue Links

            Activity

            Hide
            stigkj 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?

            Show
            stigkj 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?
            Hide
            wolle 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.

            Show
            wolle 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.
            Hide
            wolle 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]]])
            
            Show
            wolle 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 ]]])
            Hide
            wolfs 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.

            Show
            wolfs 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.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: