Problems while adding a TestRail result with an attachment

120 views Asked by At

I have been trying to add an attachment to a TestRail result using trcli, the test run and test results are all created correctly in TestRail, but when trying to upload attachments I am receiving the following error.

{
    "error": "No file attached or upload size was exceeded."
}

My invocation of trcli is as follows

#! /usr/bin/env bash

trcli -n \
    -h https://----/testrail \
    --project "M----y" \
    --username cmc----om \
    --key $TEST_RAIL_API_TOKEN \
    --verbose \
    parse_junit \
    --case-matcher "name" \
    --title "----" \
    --run-description "CLI results test 001" \
    --file "test_rail_junit.xml" \
    --suite-name "Master"

This is a snippet of my junit file

            <testcase name="C10....op" classname="RCD" time="15975.5312381">
                <properties>
                    <property name="testrail_attachment" value="/c/test.html"></property>
                </properties>
            </testcase>

Running the trcli tool with --verbose shows me all the API calls including the failing attachment API call.

**** API Call
method: POST
url: https://----/testrail/index.php?/api/v2/add_attachment_to_result/207425
response status code: 400
response body: {'error': 'No file attached or upload size was exceeded.'}
****
Submitted 1 test results in 7.2 secs.

If I confirm this last call in Postman, I get the same error.

Postman headers

Postman request body

Although I believe I have followed the advice in the other answers (below), does anyone have any further insights?

Referring to the following...

https://github.com/gurock/trcli?tab=readme-ov-file#uploading-automated-test-results

https://support.testrail.com/hc/en-us/articles/7077196481428-Attachments#addattachmenttoresult

and existing answers in Stack Overflow.

0

There are 0 answers