Hey,
I'm running playwright tests on jenkins and I want to upload the test results to Jira using Xray.
I currently have a junit xml file with the test results that is generated by playwright, and I can already import it to Jira using xray-connector plugin for jenkins.
My problem is that I want to link the created test execution to an existing test plan using the testPlanKey as described in https://docs.getxray.app/display/XRAYCLOUD/Using+Xray+JSON+format+to+import+execution+results#UsingXrayJSONformattoimportexecutionresults-%22info%22object-TestExecutionissue
My current code without the test plan attempts is:
step([
$class: 'XrayImportBuilder',
endpointName: '/junit/multipart',
importFilePath: '*.xml',
importToSameExecution: 'true',
projectKey: 'APRV',
serverInstance: 'myserverinstance'
importInParallel: 'true',
inputInfoSwitcher: 'fileContent',
inputTestInfoSwitcher: 'fileContent',
importInfo: '''{
"fields": {
"project": {
"key": "projectkey"
},
"summary": "testing xray import",
"customfield_16800":{
"value": "customvalue"
}
},
}''',
testImportInfo: '''{
"fields": {
"project": {
"key": "projectkey"
},
"customfield_16800":{
"value": "customvalue"
}
}
}'''
])
I tried adding:
"xrayFields": {
"testPlanKey": "testplankey"
}and
"testPlanKey": "testplankey"
to the importInfo JSON, the first attempt didn't throw an error but did not add the test plan to the execution after creating it, the second returned an error:
Error when executing always post condition:
hudson.AbortException: Unable to confirm Result of the upload..... Upload Failed! Status:400 Response:{"error":"testPlanKey: testPlanKey"}
at com.xpandit.plugins.xrayjenkins.task.XrayImportBuilder.tryUploadResults(XrayImportBuilder.java:828)
at com.xpandit.plugins.xrayjenkins.task.XrayImportBuilder.uploadResults(XrayImportBuilder.java:699)
at com.xpandit.plugins.xrayjenkins.task.XrayImportBuilder.importResultsSequential(XrayImportBuilder.java:600)
at com.xpandit.plugins.xrayjenkins.task.XrayImportBuilder.perform(XrayImportBuilder.java:571)
at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:100)
at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)I'm basing my attempts on various Xray documentations, all for Jira cloud and the relevant version, but nothing I do seems to work, maybe I can get the help I need here? 