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

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • junit-plugin
    • None

      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>

          [JENKINS-22747] Add Job Configuration Option to NOT fail JUnit Report publish when no xml report files

          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.

          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.

          Paul Landolt added a comment -

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

          Paul Landolt added a comment - Similar to this issue, but the failure here is for NO tests, not skipped tests

          Oleg Nenashev added a comment -

          What about xUnit plugin?
          I suppose it resolves the issue

          Oleg Nenashev added a comment - What about xUnit plugin? I suppose it resolves the issue

          +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)
          

          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)

          +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.

          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.

          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"

          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"

          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.

          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.

          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?

          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?

          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.

          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.

          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.

          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.

          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.

          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.

          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.

          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.

          Oleg Nenashev added a comment -

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

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

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

          Xavier Gouchet added a comment - Any news on the PR ? We really need a fix for this

          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)

          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)

          Paul Landolt added a comment -

          Managed with Pull Request #28

          Paul Landolt added a comment - Managed with Pull Request #28

          Oleg Nenashev added a comment -

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

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

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

              Created:
              Updated:
              Resolved: