Importing Cucumber Tests API can't dynamically add components

César Alejandro Portillo May 23, 2023

Currently, I'm using the xray cloud documentation for import cucumber test with the API:
https://docs.getxray.app/display/XRAYCLOUD/Importing+Cucumber+Tests+-+REST+v2

 

In the documentation mention this multipart element:

"testInfo" : a MultipartFormParam containing a JSON file with extra Test information. (optional)

I'm trying with this JSON, but it doesn't work for me, don't make any change on my existing test.

curl -H "Content-Type: multipart/form-data" -X POST -H "Authorization: Bearer $token" -F "file=@1.feature" -F "testInfo=testInfo.json"  https://xray.cloud.getxray.app/api/v2/import/feature?projectKey=DEMO

 

Example:

//issueFields.json
{
"fields": {
"components": [{
"name": "ComponentName"
}
]
}
}

 

 

//Request to xray.cloud

{
"multipart": {
"parts": [{
"name": "file",
"header": {
"fields": [{
"name": "Content-Disposition",
"value": "form-data; name\u003d\"file\"; filename\u003d\"file.feature\""
}, {
"name": "Content-Type",
"value": "application/octet-stream"
}, {
"name": "Content-Transfer-Encoding",
"value": "binary"
}
],
"fieldMap": {
"content-disposition": [{
"name": "Content-Disposition",
"value": "form-data; name\u003d\"file\"; filename\u003d\"file.feature\""
}
],
"content-transfer-encoding": [{
"name": "Content-Transfer-Encoding",
"value": "binary"
}
],
"content-type": [{
"name": "Content-Type",
"value": "application/octet-stream"
}
]
}
},
"body": {
"file": {
"path": "src\\test\\java\\features\\file.feature"
},
"filename": "file.feature",
"contentType": {
"mimeType": "application/octet-stream"
}
}
}, {
"name": "testInfo",
"header": {
"fields": [{
"name": "Content-Disposition",
"value": "form-data; name\u003d\"testInfo\"; filename\u003d\"testInfo\""
}, {
"name": "Content-Type",
"value": "application/json; charset\u003dUTF-8"
}, {
"name": "Content-Transfer-Encoding",
"value": "binary"
}
],
"fieldMap": {
"content-disposition": [{
"name": "Content-Disposition",
"value": "form-data; name\u003d\"testInfo\"; filename\u003d\"testInfo\""
}
],
"content-transfer-encoding": [{
"name": "Content-Transfer-Encoding",
"value": "binary"
}
],
"content-type": [{
"name": "Content-Type",
"value": "application/json; charset\u003dUTF-8"
}
]
}
},
"body": {
"file": {
"path": "src\\test\\java\\util\\xrayUploader\\issueFields.json"
},
"filename": "testInfo",
"contentType": {
"mimeType": "application/json",
"charset": {
"name": "UTF-8",
"aliases": ["UTF8", "unicode-1-1-utf-8"]
}
}
}
}
],
"charset": {
"name": "US-ASCII",
"aliases": ["iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991", "ASCII", "ISO646-US", "us", "IBM367", "cp367", "csASCII", "default", "646", "iso_646.irv:1983", "ANSI_X3.4-1968", "ascii7"]
},
"boundary": ""
},
"contentType": {
"name": "Content-Type",
"value": "multipart/form-data; boundary\xx"
},
"contentLength": 1652
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events