testrail-python icon indicating copy to clipboard operation
testrail-python copied to clipboard

updated run returns old tests

Open ghost opened this issue 8 years ago • 5 comments

How to reproduce:

  1. have existing run in testrail with already added testcase ids before
  2. can read current tests list using tr.api.tests(run['id']). It works fine.
  3. updated this run with new testcase ids using tr.api.update_run(config), where config['case_ids'] includes old and new testcases ids
  4. testrail UI shows new testcases were added correctly
  5. 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

ghost avatar Oct 19 '16 18:10 ghost

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?

ghost avatar Oct 19 '16 18:10 ghost

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.

leviable avatar Oct 19 '16 22:10 leviable

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?

ghost avatar Oct 19 '16 23:10 ghost

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....)

travispavek avatar Oct 20 '16 11:10 travispavek

@svasiljev did you ever get a chance to try your scenario with the client?

travispavek avatar Nov 29 '16 04:11 travispavek