Search code examples
jenkins-pluginsjira-xray

Set test issue parameters for Xray Connector Plugin in Jenkins


I have added the XrayImportBuilder to my pipeline script to import JUnit test results to Xray in Jira. It actually works fine and it creates Test issues and Test Executions issues as expected.

However, the json defined in importInfo just sets the parameters for the Test Execution issue in Jira. It does not affect the information for the Test issue:

step([$class: 'XrayImportBuilder', 
   endpointName: '/junit/multipart', 
   testPlanKey: 'CL-25466', 
   importFilePath: '**/target/surefire-reports/**/*.xml',
   importInfo: '''{
     "fields": {
       "project": {
          "key": "CL"
       },
       "components": [{
          "name": "123"
       }],
       "summary": "Test Execution for java junit"
    }
   }''',
importToSameExecution: 'true',
inputInfoSwitcher: 'fileContent',
serverInstance: '123435567678123435567678123435567678'])

Is there a way to add additional field information for the Test issue, except for the standard ones like testPlanKey, fixVersion..)? I already checked the documentation for XrayImportBuilder (https://www.jenkins.io/doc/pipeline/steps/xray-connector/), but it is not well described what the parameters do in detail.


Solution

  • The "importInfo" object is used to define fields the Test Execution issue. The "testImportInfo" object, which is something quite new, is used to define fields for the Test issues. Both objects use the syntax of Jira's REST API for updating fields, making use of a "fields" JSON object as you mentioned.

    Note: thanks for the feedback on that documentation; I'll see if we can clarify it in a next version.