Problem using XrayImportBuilder in Jenkins

Total
6
Shares

I’m trying to integrate XRay in my Jenkins pipeline. For that I’m adding a step like this:

step([$class: 'XrayImportBuilder', endpointName: '/cucumber/multipart',credentialId:'credentials', importFilePath: cucumber_json_path, importInfo: """{
    "fields": {
        "customfield_100" : "customfield",
        "description": "description",
        "issuetype": {
            "name": "name"
        },
        "labels": ["label"],
        "project": {
            "key": "key"
        },
    "summary": "summary"
},
"xrayFields": {
     "testPlanKey": "examplekey"
} 
"""

When running the pipeline I’m getting the following error:

Starting XRAY: Results Import Task...

[2021-05-20T12:45:28.861Z] ##########################################################

[2021-05-20T12:45:28.861Z] ####     Xray is importing the execution results      ####

[2021-05-20T12:45:28.861Z] ##########################################################

[2021-05-20T12:45:28.861Z] XRAY_TEST_EXECS: 

[2021-05-20T12:45:28.861Z] XRAY_RAW_RESPONSE: The Jira server configuration of this task was not found.

[2021-05-20T12:45:28.861Z] XRAY_TESTS: 

[2021-05-20T12:45:28.861Z] XRAY_ISSUES_MODIFIED: 

[2021-05-20T12:45:28.861Z] XRAY_IS_REQUEST_SUCCESSFUL: false

The Jira server configuration of this task was not found.

I don’t know how to fix this problem. Any idea what could be wrong with this setup, or how could I debug this?


Solution

You need to define the "serverInstance" variable.
An example would be something like:

step([$class: 'XrayExportBuilder', filePath: '\features', issues: 'IF-1', serverInstance: '2ffc3a3e-9e2f-4279-abcd-e9301fe47bed'])

Please see some additional examples here.

Leave a Reply

Your email address will not be published. Required fields are marked *