Zephyr plugin for jenkins not uploading testing result to Jira

Prakash Ramasamy November 8, 2018

When jenkins build is completed and test execution is completed , Zephyr for Jenkins trying to update the maven sure fire report to Jira. But getting below error. Can you please sugges what  is missing here

[ZapiTestResultReporter] [INFO] Examining test results...
Build result is SUCCESS
Total Test Cases : 1ERROR: Build step failed with exception
org.json.JSONException: JSONObject["jobProgressToken"] not found.
	at org.json.JSONObject.get(JSONObject.java:473)
	at org.json.JSONObject.getString(JSONObject.java:654)
	at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.assignTests(TestCaseUtil.java:315)
	at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:641)
	at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:101)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
	at hudson.model.Build$BuildExecution.post2(Build.java:186)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
	at hudson.model.Run.execute(Run.java:1840)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)
Build step 'Publish test result to Zephyr for JIRA' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Finished: FAILURE

3 answers

1 vote
Deleted user June 7, 2019

I have the same issue and I figure out what was wrong for my JIRA installation.

This has to do with issue field configuration within the project you try to upload the test results to.

When you create an issue in the JIRA project does it require anything other than the summary field? For example, in our project it requires Component/s and Priority field set before you can create an issue. This will apply to Test type issue of Zephyr for JIRA as well.

The Zephyr plugin for Jenkins does not understand or have capability to create Test issue in JIRA using additional parameters such as Component/s and/or Priority field. So when it tries to create the Test type issue it will fail. However it does not return the error to the console (or stop) and it just assume the test issue was created correctly in JIRA. It will then try to process the "missing" data which was not there in the first place.

There are two solutions to this problem:

1. Remove the additional field configuration requirement in your JIRA project. Only the summary field should be required when creating an issue.

2. Modify the Zephyr plugin for Jenkins to support additional field configuration when pushing test results.

Option #1 is easy to do but maybe not an acceptable solution due to your project requirement.

Option #2 will require some development work, either Zephyr will have to do it or someone with strong development knowledge to modify the plugin to support this.

 

I am surprise that Zephyr themselves haven't able to figure this out by now. Or maybe they have and just don't care.

mzehetmeier September 4, 2019

I can confirm this, we have the exact same problem/stacktrace. Any solution? 

Deleted user September 9, 2019

Yes, as I mentioned in the post. You can do one of the following:

1. Remove the additional field configuration requirement in your JIRA project. Only the summary field should be required when creating an issue.

2. Modify the Zephyr plugin for Jenkins to support additional field configuration when pushing test results. See source code below:

https://github.com/jenkinsci/zephyr-for-jira-test-management-plugin 

 

Obviously #1 option is the easiest, you can create a specific project in JIRA just for Zephyr plugin with only summary field as the only requirement.

Like mzehetmeier likes this
Aries T September 26, 2019

Did any one try the solution (particularly Option#1 of creating a dedicated project with Summary field as the mandatory field), and verify that it works ?

Like thiagotrentin likes this
thiagotrentin November 8, 2019

I tried to remove all required fields but still getting this error, is there anyone else with this problem?

Christian Dohmen January 15, 2020

Hi thiagotrentin,

yes i've the same Problem.

I've several Stages and the publish the Testresults of my Unittests.

But one is constantly failing.

INFO | jvm 37 | 2020/01/15 16:22:45 | 2020-01-15 16:22:45,302 INFO [0-BAM::SRVDEVTFSBLD01.bbzdevint.local::Agent:pool-3-thread-1] [TaskExecutorImpl] Starting task 'Bereitstellen der Testergebnisse in Jira' of type 'com.thed.zephyr.zfj-bamboo:zephyrTestReporter'
INFO | jvm 37 | 2020/01/15 16:22:47 | org.json.JSONException: JSONObject["jobProgressToken"] not found.
INFO | jvm 37 | 2020/01/15 16:22:47 | at org.json.JSONObject.get(JSONObject.java:473)
INFO | jvm 37 | 2020/01/15 16:22:47 | at org.json.JSONObject.getString(JSONObject.java:654)
INFO | jvm 37 | 2020/01/15 16:22:47 | at com.thed.zephyr.bamboo.utils.rest.TestCaseUtil.assignTests(TestCaseUtil.java:316)

The Targetsystem is always the same JIRA instance and the same Project.

0 votes
Ankur Sharma February 6, 2019

Encountering same issue. Have this issue resolved?

0 votes
April Rollon December 20, 2018

Encountering same issue. Have this issue resolved?

Suggest an answer

Log in or Sign up to answer