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

java.lang.NullPointerException when publish result to JIRA cloud

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Zephyr for jira test management plugin: 1.4
      Jenkins: 2.46.2
      JIRA Cloud: JIRA v1000.910.0
      Zephyr: Zephyr for JIRA Cloud2.1.3-final
      ZAPI: 1.0.2-AC

      We want to publish test result from Jenkins to JIRA cloud. I tried Zephyr for JIRA test management plugin on a JIRA server test instance, everything worked. But I got following error when posting result to JIRA cloud product instance. 

      [ZapiTestResultReporter] [INFO] Examining test results...
      Build result is SUCCESS
      Total Test Cases : 3ERROR: Build step failed with exception
      java.lang.NullPointerException
      at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.executeTestsZFJC(TestCaseUtil.java:1066)
      at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:604)
      at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:99)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
      at hudson.model.Build$BuildExecution.post2(Build.java:185)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
      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:410)
      Build step 'Publish test result to Zephyr for JIRA' marked build as failure
      Warning: this build has no associated authentication, so build permissions may be lacking, and downstream projects which cannot even be seen by an anonymous user will be silently skipped
      Finished: FAILURE

       

          [JENKINS-43884] java.lang.NullPointerException when publish result to JIRA cloud

          Dada Wineman added a comment - - edited

          similar issues here:
          _Recording test results
          [ZapiTestResultReporter] [INFO] Examining test results...
          Build result is SUCCESS
          Total Test Cases : 1ERROR: Build step failed with exception
          java.lang.NullPointerException
          at java.lang.String.replace(String.java:2180)
          at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.fetchExecutionIdsZFJC(TestCaseUtil.java:884)
          at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:571)
          at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:99)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
          at hudson.model.Build$BuildExecution.post2(Build.java:186)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
          at hudson.model.Run.execute(Run.java:1753)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:405)
          Build step 'Publish test result to Zephyr for JIRA' marked build as failure
          Finished: FAILURE_

          Dada Wineman added a comment - - edited similar issues here: _Recording test results [ZapiTestResultReporter] [INFO] Examining test results... Build result is SUCCESS Total Test Cases : 1ERROR: Build step failed with exception java.lang.NullPointerException at java.lang.String.replace(String.java:2180) at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.fetchExecutionIdsZFJC(TestCaseUtil.java:884) at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:571) at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:99) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665) at hudson.model.Run.execute(Run.java:1753) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:405) Build step 'Publish test result to Zephyr for JIRA' marked build as failure Finished: FAILURE_

          greg re added a comment -

          Hi guys, are there any updates on this? What might be the issue?

          greg re added a comment - Hi guys, are there any updates on this? What might be the issue?

          Dada Wineman added a comment - - edited

          According to the Zephyr support it is related to the Junit XML, which HAS to be genereted by surfire. I don't use Surfire, so couldn't validate if it is working with that.
          Here is their response:
          _ZAPI is needed for the same and you need to be logged into it and Jira for the same

          Another preconditions are that
          1. You should be selecting Maven project while using this plugin and the report generated should be 'sure-fire' report which is required by the plugin. We have seen similar issues with customers when the output is not of maven surefire reports
          2.Also please check if your Jira has mandatory Fields.We support for now only "Summary" as Mandatory field

          Also note that as the plugin is open source to get your integration working, I would recommend looking at the source code and then modifying the parser that suits your needs. You can find the source code in the link below:
          https://github.com/jenkinsci/zephyr-for-jira-test-management-plugin

          Dada Wineman added a comment - - edited According to the Zephyr support it is related to the Junit XML, which HAS to be genereted by surfire. I don't use Surfire, so couldn't validate if it is working with that. Here is their response: _ZAPI is needed for the same and you need to be logged into it and Jira for the same Another preconditions are that 1. You should be selecting Maven project while using this plugin and the report generated should be 'sure-fire' report which is required by the plugin. We have seen similar issues with customers when the output is not of maven surefire reports 2.Also please check if your Jira has mandatory Fields.We support for now only "Summary" as Mandatory field Also note that as the plugin is open source to get your integration working, I would recommend looking at the source code and then modifying the parser that suits your needs. You can find the source code in the link below: https://github.com/jenkinsci/zephyr-for-jira-test-management-plugin

          Robert Jiang added a comment -

          I checked out the source code and debugged 1.4 version plugin and found it's due to the mandatory customized filed of our testcases. I've modified the code and fixed the issue. 

          Robert Jiang added a comment - I checked out the source code and debugged 1.4 version plugin and found it's due to the mandatory customized filed of our testcases. I've modified the code and fixed the issue. 

          greg re added a comment -

          Sorry, I don't understand. All the fields are populated:

          JIRA URL, Project Name, Version, Cycle, Cycle Duration, Cycle Prefix.

           

          Why is NullPointer appearing then? 

           

          greg re added a comment - Sorry, I don't understand. All the fields are populated: JIRA URL, Project Name, Version, Cycle, Cycle Duration, Cycle Prefix.   Why is NullPointer appearing then?   

          Patrick Bar. added a comment - - edited

          Same problem here, is there a solution?

          Our Environment:

          • Jenkins ver. 2.60.1
            • Zephyr for JIRA Test Management plugin 1.4
          • JIRA v7.3.8
            • Zephyr for JIRA 3.6.1
            • ZAPI for JIRA 2.5.0

          We get this NPE only, if we used the option "New Cycle" or if we select an empty cycle.
          So, at the first try, the cycle with all tests will be created, but without the results, if we retry in the same cycle the results will be pushed correctly to JIRA. The same, if we create an empty cycle (directly in JIRA), all tests without any results will be created (first try), the second pushed then the results.

          Is there already any solution or workaround? Thanks for helping.

           

          Here is our stack trace:

          Recording test results
          Archiving artifacts
          [ZapiTestResultReporter] [INFO] Examining test results...
          Build result is SUCCESS
          Total Test Cases : 3ERROR: Build step failed with exception
          java.lang.NullPointerException
          at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.executeTests(TestCaseUtil.java:424)
          at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:564)
          at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:99)
          at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
          at hudson.model.Build$BuildExecution.post2(Build.java:186)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621)
          at hudson.model.Run.execute(Run.java:1760)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:97)
          at hudson.model.Executor.run(Executor.java:405)
          Build step 'Publish test result to Zephyr for JIRA' marked build as failure
          Finished: FAILURE
           

          Patrick Bar. added a comment - - edited Same problem here, is there a solution? Our Environment: Jenkins ver. 2.60.1 Zephyr for JIRA Test Management plugin 1.4 JIRA v7.3.8 Zephyr for JIRA 3.6.1 ZAPI for JIRA 2.5.0 We get this NPE only, if we used the option "New Cycle" or if we select an empty cycle. So, at the first try, the cycle with all tests will be created, but without the results, if we retry in the same cycle the results will be pushed correctly to JIRA. The same, if we create an empty cycle (directly in JIRA), all tests without any results will be created (first try), the second pushed then the results. Is there already any solution or workaround? Thanks for helping.   Here is our stack trace: Recording test results Archiving artifacts [ZapiTestResultReporter] [INFO] Examining test results... Build result is SUCCESS Total Test Cases : 3ERROR: Build step failed with exception java.lang.NullPointerException at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.executeTests(TestCaseUtil.java:424) at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:564) at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:99) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676) at hudson.model.Build$BuildExecution.post2(Build.java:186) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621) at hudson.model.Run.execute(Run.java:1760) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:405) Build step 'Publish test result to Zephyr for JIRA' marked build as failure Finished: FAILURE  

          vishwa yhaoo added a comment -

          Null pointer exception occurs if their is no bug in JIRA with the name equivalent to your script's package name.

          For example if your package name is com.hello and your function name is test1() in the script, then there should be a bug in JIRA with the name com.hello.test1.

          And the issue type as "Test".

           

          Now when u run the build from jenkins, after execution it will search for the name com.hello.test1 and publish the result(pass/fail) to it.

           

          This works especially for TestNG scripts.

          vishwa yhaoo added a comment - Null pointer exception occurs if their is no bug in JIRA with the name equivalent to your script's package name. For example if your package name is com.hello and your function name is test1() in the script, then there should be a bug in JIRA with the name com.hello.test1. And the issue type as "Test".   Now when u run the build from jenkins, after execution it will search for the name com.hello.test1 and publish the result(pass/fail) to it.   This works especially for TestNG scripts.

            zeedeveloper Zephyr Developer
            jxzrobert Robert Jiang
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: