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

Testcase updation with API


#1

Hello Testrail community,
I am using Testrail API to update testcases in Testrail testcases. I use a custom python script to do the testcase updation. The testrail API version is 0.3.8.
Sometimes, the testcase updation fails. Please see stacktrace below.
I sense it is a bug from the API side. Can it be fixed ?

"
Executing test #24

0:00:09.237000

Updating test #24 with a status of Status-1

Executing test #25

0:00:00.253000

Updating test #25 with a status of Status-1

Executing test #26

0:00:01.955000

Updating test #26 with a status of Status-1

Executing test #27

0:00:04.134000

Updating test #27 with a status of Status-1

Traceback (most recent call last):

File "./softnas.test/testrail_publisher.py", line 200, in <module>

platform= platform_name)

File "./softnas.test/testrail_publisher.py", line 118, in report_testrail

result.test = test

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/testrail/result.py", line 113, in test

test_obj._content[‘id’], test_obj._content[‘run_id’])

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/testrail/api.py", line 501, in test_with_id

return list(filter(lambda x: x[‘id’] == test_id, self.tests(run_id)))[0]

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/testrail/api.py", line 493, in tests

_tests = self._get(‘get_tests/%s’ % run_id)

File "<decorator-gen-4>", line 2, in _get

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/retry/api.py", line 74, in retry_decorator

logger)

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/retry/api.py", line 33, in __retry_internal

return f()

File "<decorator-gen-3>", line 2, in _get

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/retry/api.py", line 74, in retry_decorator

logger)

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/retry/api.py", line 33, in __retry_internal

return f()

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/testrail/api.py", line 595, in _get

self._raise_on_429_or_503_status®

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/testrail/api.py", line 175, in _raise_on_429_or_503_status

wait_amount = int(resp.headers[‘Retry-After’])

File "/home/softnas/workspace/API_AWS_DISKS_POOLS_GENERAL/env/local/lib/python2.7/site-packages/requests/structures.py", line 54, in getitem

return self._store[key.lower()][1]

KeyError: ‘retry-after’

Build step ‘Execute a set of scripts’ marked build as failure
"


#2

Just to add that, I am using Testrail version TestRail v5.5.1.3746.


#3

Any help here is immensely appreciated.