Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

[API] Upload screenshot

#62

Hi guys,

Thanks for all your feedback! I added your votes.

Regards,
Sabina

#63

+1 I need this, too :slight_smile:

#64

Hi, Matze. Thanks, I added yours too.

Regards,
Sabina

#65

+1 for results with attachments

#66

Hi, yayura. Thanks for your feedback! Your vote is also added :slight_smile:

Regards,
Sabina

#67

Hi,

Please add one more voice from me as well, for test results with attachments.

Regards,
Ivan

#68

Considering this request is only 4 years old, please add 1 vote.

#69

Hi all - this feature is planned for TestRail 5.7, later this year.

Cheers,
Simon

3 Likes
#70

Add my voice and all of our team, we are waiting forward to the implementation!

#71

+1 My vote for this feature…

#72

Hi Swaminathan,

Your vote has been added to this.

Thanks,
Jon

#73

Please add me in, this feature is super useful for us. Thx

#74

Hi Ray,

Your vote has been counted!

Thanks,
Jon

#75

We would love this option too!

#76

Hi Denise,

Your vote has been added.

Thanks,
Jon

#77

+1! Looking forward to v5.7… any planned date?

#78

Hey there,

I’ve added your vote to the feature request. Thanks for the feedback! Currently we can’t give a specific timeframe for 5.7 release, but we’re hard at work getting it all ready and are hoping to have some news soon.

#79

Hi Scott,

I have tried the new endpoint ‘add_attachment_to_result’ on 5.7 with Enterprise Features, however didn’t succeed. I did get 200 status code in return , however, there was an error message:
‘{“error”:“No attachment or file uploaded.”}’
I made sure there is screenshot in the path, and used following code:

“”"
uri = ‘{}/index.php?/api/v2/add_attachment_to_result/{}’.format(my_testrail_url, result_id)
auth = base64.b64encode(’%s:%s’ % (user, password))
headers = {
“Authorization”: ‘Basic %s’ % auth
}
screenshot_path = os.path.join(_screenshot_dir, ‘screenshot.png’)
files = {‘Attachment’: (‘screenshot.png’, open(screenshot_path, ‘rb’), ‘image/png’)}
requests.post(uri, files=files, headers=headers)
“”"
Is it because the format I use is not correct?

Thank you in advance.

#80

Hi @May,

Based on the code provided, it appears you are using Python 3.X and the requests library. You may find the following example helpful for this:

auth = str(…).strip()
headers = {‘Authorization’: 'Basic ’ + auth}
files = {‘attachment’: (open(file_path, ‘rb’))}
response = requests.post(url, headers=headers, files=files)

The above example should work with a file upload and you would not need to specify the file type.

#81

Hi @Jon,

Thanks for your help, that worked like a charm !!

1 Like