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

Get test cases appears to return None #75

Closed
ctrickler opened this issue Jun 7, 2018 · 8 comments
Closed

Get test cases appears to return None #75

ctrickler opened this issue Jun 7, 2018 · 8 comments
Labels

Comments

@ctrickler
Copy link

Using test client and the get test cases function, see sample code below. I am always getting None, yet if I manually create the URL with the ids, it appears I get valid results.

        credentials = BasicAuthentication(TEST_TOKEN_USER, TEST_TOKEN_VALUE)
        connection = VssConnection(base_url=TEST_SITE, creds=credentials)
        test_client = connection.get_client('vsts.test.v4_1.test_client.TestClient')

        plans = test_client.get_plans(TEST_PROJECT)
        for plan in plans:
            print(plan.id, plan.name)
            plancounts[plan.name] = 0
            suites = test_client.get_test_suites_for_plan(TEST_PROJECT, plan.id)
            for suite in suites:
                print("\t" + suite.name)
                cases = test_client.get_test_cases(suite.project.id, plan.id, suite.id)
@tedchamb
Copy link
Member

tedchamb commented Jun 7, 2018

@ctrickler thanks for reporting. Can you turn on debug logging and let us know the request url and the response after scrubbing any private data?

import logging

logging.basicConfig(level=logging.DEBUG)

Thanks,
Ted

@ctrickler
Copy link
Author

ctrickler commented Jun 7, 2018 via email

@tedchamb
Copy link
Member

tedchamb commented Jun 8, 2018

@ctrickler thank you, the info you provided was helpful. I am working on the fix.

@tedchamb
Copy link
Member

tedchamb commented Jun 8, 2018

Fixed with #76, #77

@tedchamb tedchamb added bug and removed investigating labels Jun 8, 2018
@tedchamb
Copy link
Member

tedchamb commented Jun 8, 2018

@ctrickler Thanks again for reporting this issue. The fix is now ready on pypi.

https://github.com/Microsoft/vsts-python-api/releases/tag/0.1.8

@ctrickler
Copy link
Author

ctrickler commented Jun 11, 2018 via email

@ctrickler
Copy link
Author

ctrickler commented Jun 11, 2018 via email

@tedchamb
Copy link
Member

@ctrickler This python library is a thin wrapper around the VSTS REST APIs. You can find more information about how the APIs work in our REST documentation found here:
https://docs.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-4.1

Information on the get_test_cases api mentioned above can be found here:
https://docs.microsoft.com/en-us/rest/api/vsts/test/test%20%20suites/get%20test%20cases?view=vsts-rest-5.0

I am not an expert on the Test APIs, but it looks to me like there is a work item reference returned from the API in the testCase property. You should be able to use the testCase.id property along with the work item tracking client, to get details on that work item. See here:
https://docs.microsoft.com/en-us/rest/api/vsts/wit/work%20items/get%20work%20item?view=vsts-rest-4.1

With the get_work_item api, you can specify which fields you would like returned by specifying them in the fields query parameter.

If you have other questions about the APIs themselves, you can ask them in the feedback section on the REST API Documentation site, and those questions will get routed to the appropriate team. You will find the feedback section at the bottom of the resource page, which is the parent page (see TOC on left) of the endpoint page.

I hope this helps,
Ted

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

No branches or pull requests

2 participants