Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extract all parameter to test_plan_client method #515

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

omixximo
Copy link

@omixximo omixximo commented Jan 3, 2025

As I was using the library I realized that I was not getting all test suites of my project. After a fast search I found that the API only returns stacks of 200 records.

When using the "get_test_suites_for_plan" method I can pass the "continuation_token" but there is not a easy way of obtaining this token unless duplicating the method.

I suggest to add a parameter to automatically call the API multiple times when a continuation token is returned by the API.

This can be applied to other methods like "get_test_plans" and maybe it must be replicated to the other "test_plant_client.py" classes.

@@ -361,6 +361,9 @@ def get_test_suites_for_plan(self, project, plan_id, expand=None, continuation_t
version='7.0',
route_values=route_values,
query_parameters=query_parameters)
if extract_all and 'x-ms-continuationtoken' in response.headers:
continuation_token = response.headers['x-ms-continuationtoken']
return self._deserialize('[TestPlan]', self._unwrap_collection(response)) + self.get_test_plans(project, plan_id, expand=expand, continuation_token=continuation_token, as_tree_view=as_tree_view, extract_all=True)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response is being deserialized using self._deserialize('[TestPlan]', ...). I believe this should be self._deserialize('[TestSuite]', ...) to match the method's return type and the API response structure.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the recursive call is made to self.get_test_plans(...). I believe it should be calling self.get_test_suites_for_plan(...) to fetch the next page of test suites. If i am correct (which i might not be) then due to calling the wrong method (get_test_plans), the arguments are mismatched. plan_id is passed where owner is expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants