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

Unable to add comments and results for testrun on testrail : Field :run_id is not a valid test run


#1

Hi,

I am trying to add comments and results for test runs on testrail. However I got success in fetching test case from testrail but when trying to add comment for specific testrun, my code returns :

Traceback (most recent call last):
File “./bind_testrail.py”, line 19, in
{ ‘status_id’: 78988, ‘comment’: ‘This test worked fine!’ }
File “/root/PyPlay/HUB/testrail.py”, line 52, in send_post
return self.__send_request(‘POST’, uri, data)
File “/root/PyPlay/HUB/testrail.py”, line 86, in __send_request
(e.code, error))
testrail.APIError: TestRail API returned HTTP 400 (“Field :run_id is not a valid test run.”)

Here is part of my code which is able to fetch testcase but not able to update/add comments on test run:

case = client.send_get(‘get_case/17987’)

def pretty(value):
return PrettyPrinter(indent=4).pformat(value)

print(‘Test Case:\n{}’.format(pretty(case)))

result = client.send_post(
‘add_result_for_case/17987/78988’,
{ ‘status_id’: 78988, ‘comment’: ‘This test worked fine!’ }
)

print(‘Test Case:\n{}’.format(pretty(result)))

Note: URL to my test run is : http://xx.xx.xx.xx/testrail/index.php?/tests/view/78988&group_by=cases:section_id&group_order=asc&group_id=1609