testrail-python
testrail-python copied to clipboard
updated run returns old tests
How to reproduce:
- have existing run in testrail with already added testcase ids before
- can read current tests list using tr.api.tests(run['id']). It works fine.
- updated this run with new testcase ids using tr.api.update_run(config), where config['case_ids'] includes old and new testcases ids
- testrail UI shows new testcases were added correctly
- trying to get updated list of tests for this run using tr.api.tests(run['id']) It returns the same tests list as in step 2
Adding tr.api.flush_cache() right after tr.api.update_run(config) solved the above issue. As far as I understand it should work without this additional call, right?
Yeah, shouldn't need to flush the cache like that. The method you are calling (update_run
) is decorated with a cache updating decorator that should handle that for you.
It might be because you're using the API object directly, and not through the client as intended. It might be that the updatecache functionality isn't quite right for this scenario.
Thanks. I found it's easier to use through API. But I can try to do the same using the client object. It's not clear for me which one is better. Do both offer the same functionality?
I am guessing you came across a bug in caching so I am glad you have a workaround for now. However if you could try it using the client as well that would be a good datapoint for us. The client is just one level of abstraction higher than the api.
For example with the client: client.suite() # returns empty suite object if you want to make a new suite client.suite(2) # returns suite with id 2 client.suite('suite_name') # returns suite with matching name
Also methods like add, delete, update just take an object and then will figure out what respective api method to call based on object type (suite, project, test....)
@svasiljev did you ever get a chance to try your scenario with the client?