java.lang.ArithmeticException: / by zero

Jenkins JIRA | Daniel Wright | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    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. {code} 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) {code} Feel free to contact me if you need any more information.

    Jenkins JIRA | 4 years ago | Daniel Wright
    java.lang.ArithmeticException: / by zero
  2. 0

    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. {code} 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) {code} Feel free to contact me if you need any more information.

    Jenkins JIRA | 4 years ago | Daniel Wright
    java.lang.ArithmeticException: / by zero

    Root Cause Analysis

    1. java.lang.ArithmeticException

      / by zero

      at org.jenkinsci.plugins.xunit.threshold.SkippedThreshold.getResultThresholdPercent()
    2. org.jenkinsci.plugins
      XUnitPublisher.perform
      1. org.jenkinsci.plugins.xunit.threshold.SkippedThreshold.getResultThresholdPercent(SkippedThreshold.java:42)
      2. org.jenkinsci.plugins.xunit.XUnitPublisher.processResultThreshold(XUnitPublisher.java:353)
      3. org.jenkinsci.plugins.xunit.XUnitPublisher.getResultWithThreshold(XUnitPublisher.java:339)
      4. org.jenkinsci.plugins.xunit.XUnitPublisher.getBuildStatus(XUnitPublisher.java:322)
      5. org.jenkinsci.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:125)
      6. org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:93)
      6 frames
    3. Hudson
      Executor.run
      1. hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
      3. hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
      4. hudson.model.Build$BuildExecution.post2(Build.java:183)
      5. hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732)
      6. hudson.model.Run.execute(Run.java:1568)
      7. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      8. hudson.model.ResourceController.execute(ResourceController.java:88)
      9. hudson.model.Executor.run(Executor.java:236)
      9 frames