Importing xUnit XML for a suite of test cases which does not contain a failure results in a Null pointer exception. Using xml generated from the python unittest framework for a suite with two passing test cases, we encountered a Null pointer exception:
[ZapiTestResultReporter] [INFO] Examining test results... Build result is SUCCESS Total Test Cases : 2ERROR: Build step failed with exception java.lang.NullPointerException at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.executeTests(TestCaseUtil.java:331) at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:441) at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:98) 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:726) at hudson.model.Build$BuildExecution.post2(Build.java:185) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671) 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:381) Build step 'Publish test result to Zephyr for JIRA' marked build as failure
Looking through the source code, we noticed in TestCaseUtil.java#L331, that response is closed when passList.size > 0. However, response becomes non null only if the failList.size > 0 in line 326. Line 331 should check to see if response != null before attempting to close and continue if it is null.
|