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

Division by zero when checking xunit thresholds with empty test report

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: xunit-plugin
    • Labels:
    • Similar Issues:

      Description

      We use pytest as a test framework to generate a junitxml report that can be read by Jenkin's xunit plugin. Due to a configuration error, pytest exited before running any tests and generated an empty test report.

      In the build overview XUnit correctly reports that no tests were ran. In the Post Build Actions XUnit.XUnitPublisher also correctly warns that the test report is empty, but then continues to check the 'Skipped Tests' and 'Failed Tests' threshold; this aborts due to an exception: / by zero.

      Using xunit v1.52.

      Archiving artifacts
      [xUnit] [INFO] - Starting to record.
      [xUnit] [INFO] - Processing JUnit
      [xUnit] [INFO] - [JUnit] - 1 test report file(s) were found with the pattern 'TestReportUHF_ziServer2.xml' relative to 'C:\Users\ci\jenkins\workspace\97_Regression_Test_UHF_ziServer2' for the testing framework 'JUnit'.
      [xUnit] [WARNING] - All test reports are empty.
      [xUnit] [INFO] - Check 'Failed Tests' threshold.
      [xUnit] [INFO] - Check 'Skipped Tests' threshold.
      ERROR: Publisher org.jenkinsci.plugins.xunit.XUnitPublisher aborted due to exception
      java.lang.ArithmeticException: / by zero
      	at org.jenkinsci.plugins.xunit.threshold.SkippedThreshold.getResultThresholdPercent(SkippedThreshold.java:42)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.processResultThreshold(XUnitPublisher.java:353)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.getResultWithThreshold(XUnitPublisher.java:339)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.getBuildStatus(XUnitPublisher.java:322)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:125)
      	at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:93)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
      	at hudson.model.Build$BuildExecution.post2(Build.java:183)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732)
      	at hudson.model.Run.execute(Run.java:1568)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      

      Feel free to contact me if you need any more information.

        Attachments

          Activity

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              danieldwright Daniel Wright
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: