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 created issue -

          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
          Paul Landolt made changes -
          Link New: This issue is related to JENKINS-7970 [ JENKINS-7970 ]

          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
          Oleg Nenashev made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          +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 made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

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

              Created:
              Updated:
              Resolved: