allankp / pytest-testrail

pytest plugin for integration with TestRail, for creating testruns and updating results
MIT License
96 stars 124 forks source link

support add_results_for_cases API to upload all results in single API invocation #84

Closed reverbc closed 5 years ago

reverbc commented 5 years ago

Is your feature request related to a problem? Please describe.

I have 3200+ test cases that I'm trying to integrate with TestRail with pytest-testrail plugin. Current implementation (https://github.com/allankp/pytest-testrail/blob/v2.3.2/pytest_testrail/plugin.py#L28 https://github.com/allankp/pytest-testrail/blob/v2.3.2/pytest_testrail/plugin.py#L271-L294) reports result for each test case with add_result_for_case API, which takes lot of time (tens of minutes) to invoke APIs for 3200+ times.

Describe the solution you'd like

Add the option to enable batch upload (something like --tr-testrun-batch-report?) so can also keep the backward compatibility to existing users.

Describe alternatives you've considered

None

Additional context

API available since TestRail 3.1. API doc reference: http://docs.gurock.com/testrail-api2/reference-results#add_results_for_cases

allankp commented 5 years ago

@reverbc I'm all in favour of this, when I originally created the plugin this would have been the better way to do it. Also avoids rate limiting issues. If you are willing to I suggest changing the underlying update method to use the batch endpoint instead. If you can put up a PR I'm more than happy to help / review