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

Add Job Configuration Option to NOT fail JUnit Report publish when no xml report files

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: junit-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      JUnit report publication will fail if there are no unit test report XML files. I'd like to have this behaviour configurable, so that I can ignore this error.

      Cobertura reporting (for example) has a job option "Fail builds if no reports".
      In the job config.xml file for Cobertura reporting, you'll see

      <failNoReports>false</failNoReports>

        Attachments

          Issue Links

            Activity

            Hide
            landoltjp Paul Landolt added a comment -

            I create build jobs automatically, sifting through the repository and running a job to create the jobs from a standard template. Most all of my jobs have unit tests. Some "very few" projects (in their initial state) have no unit tests. I'd rather see them as unstable rather than failed.

            Show
            landoltjp Paul Landolt added a comment - I create build jobs automatically, sifting through the repository and running a job to create the jobs from a standard template. Most all of my jobs have unit tests. Some "very few" projects (in their initial state) have no unit tests. I'd rather see them as unstable rather than failed.
            Hide
            landoltjp Paul Landolt added a comment -

            Similar to this issue, but the failure here is for NO tests, not skipped tests

            Show
            landoltjp Paul Landolt added a comment - Similar to this issue, but the failure here is for NO tests, not skipped tests
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            What about xUnit plugin?
            I suppose it resolves the issue

            Show
            oleg_nenashev Oleg Nenashev added a comment - What about xUnit plugin? I suppose it resolves the issue
            Hide
            adjohnson916 Anders Johnson added a comment -

            +1

            I'd like to be able to configure this plugin so that it won't mark as failed or unstable when no report files are found.

            Here's failure output for that scenario in Jenkins ver. 1.607:

            Recording test results
            ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
            hudson.AbortException: No test report files were found. Configuration error?
            	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:116)
            	at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:93)
            	at hudson.FilePath.act(FilePath.java:989)
            	at hudson.FilePath.act(FilePath.java:967)
            	at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:90)
            	at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:120)
            	at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:137)
            	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:74)
            	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
            	at hudson.model.Build$BuildExecution.post2(Build.java:183)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
            	at hudson.model.Run.execute(Run.java:1766)
            	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
            	at hudson.model.ResourceController.execute(ResourceController.java:98)
            	at hudson.model.Executor.run(Executor.java:374)
            
            Show
            adjohnson916 Anders Johnson added a comment - +1 I'd like to be able to configure this plugin so that it won't mark as failed or unstable when no report files are found. Here's failure output for that scenario in Jenkins ver. 1.607: Recording test results ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception hudson.AbortException: No test report files were found. Configuration error? at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:116) at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:93) at hudson.FilePath.act(FilePath.java:989) at hudson.FilePath.act(FilePath.java:967) at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:90) at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:120) at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:137) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:74) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670) at hudson.model.Run.execute(Run.java:1766) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374)
            Hide
            eva_unit03 Christian Venegas added a comment -

            +1 here as well. We create jUnit files that fail to be parsed by xUnit. jUnit doesn't have any issues parsing them but if we don't create test files, we get build failures instead of just setting it to unstable or letting it pass.

            Show
            eva_unit03 Christian Venegas added a comment - +1 here as well. We create jUnit files that fail to be parsed by xUnit. jUnit doesn't have any issues parsing them but if we don't create test files, we get build failures instead of just setting it to unstable or letting it pass.
            Hide
            jplandolt Paul Landolt added a comment -

            Reopened as this issue has not been resolved.

            During the "Publish JUnit test result report" Post-build step, the JUnit XML files are collected and processed. If there are no files to collect (e.g., no unit tests written) then the step fails with the message:

            ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
            hudson.AbortException: No test report files were found. Configuration error?

            While there may be code in place to not fail skipped test, there is no handling of the situation where there are intentionally no JUnit tests.

            I manage 300 jobs from templates. It would be onerous to go into jobs and add / remove reporting manually based on the existence or absence of unit test reports.

            Compare this to the "Publish Cobertura Coverage Report" post-build step, which has the option to ignore "Fail builds if no reports"

            Show
            jplandolt Paul Landolt added a comment - Reopened as this issue has not been resolved. During the "Publish JUnit test result report" Post-build step, the JUnit XML files are collected and processed. If there are no files to collect (e.g., no unit tests written) then the step fails with the message: ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception hudson.AbortException: No test report files were found. Configuration error? While there may be code in place to not fail skipped test, there is no handling of the situation where there are intentionally no JUnit tests. I manage 300 jobs from templates. It would be onerous to go into jobs and add / remove reporting manually based on the existence or absence of unit test reports. Compare this to the "Publish Cobertura Coverage Report" post-build step, which has the option to ignore "Fail builds if no reports"
            Hide
            jplandolt Paul Landolt added a comment -

            I'll take this one. I've worked up a solution. I'll create a branch, get the code in, and make it available for peer review.

            My current solution does not have any unit tests, I would really like some input to this as I'm not clear on how to test a plugin without it being installed and on an active Jenkins instance.

            Show
            jplandolt Paul Landolt added a comment - I'll take this one. I've worked up a solution. I'll create a branch, get the code in, and make it available for peer review. My current solution does not have any unit tests, I would really like some input to this as I'm not clear on how to test a plugin without it being installed and on an active Jenkins instance.
            Hide
            jplandolt Paul Landolt added a comment -

            If I'm going to create a branch, should I name the branch "JENKINS-22747", or is there a protocol for such a thing from an unvetted participant?

            Show
            jplandolt Paul Landolt added a comment - If I'm going to create a branch, should I name the branch " JENKINS-22747 ", or is there a protocol for such a thing from an unvetted participant?
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Hi Paul,

            If you crate a branch in your own fork, feel free to set up any name. The only recommendation is to reference the issue in the pull request title and commits.

            Show
            oleg_nenashev Oleg Nenashev added a comment - Hi Paul, If you crate a branch in your own fork, feel free to set up any name. The only recommendation is to reference the issue in the pull request title and commits.
            Hide
            jplandolt Paul Landolt added a comment -

            Will do. I'm just finishing some live testing with the work I've done. I should be able to check in (or push request, or whatever it's called in GIT) the changes within the next 24 hours so that it can be reviewed.

            And it does require at least 2 unit tests, so if you see the best way to test them during review, please let me know; I'd like get the chance to learn more regarding testing this particular plugin.

            Show
            jplandolt Paul Landolt added a comment - Will do. I'm just finishing some live testing with the work I've done. I should be able to check in (or push request, or whatever it's called in GIT) the changes within the next 24 hours so that it can be reviewed. And it does require at least 2 unit tests, so if you see the best way to test them during review, please let me know; I'd like get the chance to learn more regarding testing this particular plugin.
            Hide
            jplandolt Paul Landolt added a comment - - edited

            Pull request complete.

            https://github.com/jenkinsci/junit-plugin/pull/30

            Please excuse any mistakes as I'm just learning how to work with GIT.

            Show
            jplandolt Paul Landolt added a comment - - edited Pull request complete. https://github.com/jenkinsci/junit-plugin/pull/30 Please excuse any mistakes as I'm just learning how to work with GIT.
            Hide
            jplandolt Paul Landolt added a comment -

            Not getting a response to this so I'm going to set it "Unassigned" to see if I can get a nibble from one of the project committers.

            Show
            jplandolt Paul Landolt added a comment - Not getting a response to this so I'm going to set it "Unassigned" to see if I can get a nibble from one of the project committers.
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Thanks for taking the action.
            I've totally missed your PR.I'll try to review it ASAP

            Show
            oleg_nenashev Oleg Nenashev added a comment - Thanks for taking the action. I've totally missed your PR.I'll try to review it ASAP
            Hide
            xgouchet Xavier Gouchet added a comment -

            Any news on the PR ? We really need a fix for this

            Show
            xgouchet Xavier Gouchet added a comment - Any news on the PR ? We really need a fix for this
            Hide
            jplandolt Paul Landolt added a comment -

            There is a code solution for this. Oleg is reviewing the Pull request and should be accepting it into the plugin soon. (That's my take on it)

            Show
            jplandolt Paul Landolt added a comment - There is a code solution for this. Oleg is reviewing the Pull request and should be accepting it into the plugin soon. (That's my take on it)
            Hide
            jplandolt Paul Landolt added a comment -

            Managed with Pull Request #28

            Show
            jplandolt Paul Landolt added a comment - Managed with Pull Request #28
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Closing as a duplicate of JENKINS-12815 . The fchange has been released yesterday (junit-1.10)

            Show
            oleg_nenashev Oleg Nenashev added a comment - Closing as a duplicate of JENKINS-12815 . The fchange has been released yesterday (junit-1.10)

              People

              • Assignee:
                jplandolt Paul Landolt
                Reporter:
                landoltjp Paul Landolt
              • Votes:
                3 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: