travispavek / testrail-python

Python library for interacting with TestRail via REST APIs.
MIT License
32 stars 33 forks source link

updated run returns old tests #74

Open ghost opened 8 years ago

ghost commented 8 years ago

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 commented 8 years ago

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?

leviable commented 8 years ago

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.

ghost commented 8 years ago

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?

travispavek commented 8 years ago

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 commented 7 years ago

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