Below curl command works if post to execution evidence in Xray and attaching test.log file to evidence field:
curl -H "Content-Type: application/json" -X POST -u user:pwd --data @test.json https://jira.opentv.com/rest/raven/1.0/api/testrun/{id}/attachment
where test.json has this,
{
"data":"VGhpcyBmaWxlIGlzIHRlc3RpbmcgZm9yIHVwbG9hZCB0byBleGVjdXRpb24gZGV0YWlscy4=",
"filename":"test.log",
"contentType":"application/json"
} (in json 'data' is base64 encoded which is only supported in xray)
but when i try the same with below requests.post it fails.
requests.post('https://jira.opentv.com/rest/raven/1.0/api/testrun/{id}/attachment',headers = {'Content-Type':'application/json'},data={"data":"VGhpcyBmaWxlIGlzIHRlc3RpbmcgZm9yIHVwbG9hZCB0byBleGVjdXRpb24gZGV0YWlscy4=","fileName":"test.log","Content-Type":"application/json"},auth=('user', 'pwd'))
Thanks in Advance..
the curl cmd is executed from linux machine and python requests.post from windows. Both are reachable to Xray.
Hi @Suryakant
Curl command works manually. The request works but will fail when using it inside your custom application.
Since the Xray itself is working, there is not much else we can help as we don't provide support to custom applications.
We do have several code samples (some using Python) which you could use as a reference to build your own application.
Please check the link Tutorials, Tips and Tricks - Automation to get those samples; remember that those samples are provided "as is" and they are not supposed to be used on production and may need adjustments to work on your environment.
Please let us know if you have any questions or issues with Xray through our Service Desk
Best Regards,
Team Xray
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.