TFS - Running a testcase from C# using REST-API

Gooly 21 Reputation points
2021-09-22T06:14:22.02+00:00

Hi all,

I'm building a custom TFS client application which is supposed to locate a test case by it's name.
Create a new Run for that test , execute the Run step by step (I'd like to have access to each single step), log actual results (versus the expected results) and Pass/Fail the test run at the end.

Are these steps supported ? If so, how ? (code samples will be most welcome).

Thanks,
Yigal.

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Jack J Jun 25,316 Reputation points
    2021-09-23T02:07:54.68+00:00

    @Gooly , based on my test, you could try to install nuget-package Microsoft.TeamFoundationServer.Client to use the code in Github.

    Also, I noticed that there is a compile error in the code after I add the package.

    You could make changes in the following code. (just add two null parameters otherwise it will cause conflict between classes)

      var attachmentObject = _witClient.CreateAttachmentAsync(uploadStream, "Canvas.png", "Simple",null,null).Result;  
    

    Update for the steps that how to use the nuget-package without internet.

    First, Please download the nuget-package from the link Microsoft.TeamFoundationServer.Client in the another computer.

    134857-image.png

    Second, after the downloading, you will get a NUPKG file and copy it to the no-internet computer.

    Third, you could create a folder and copy the NUPKG file to the folder, like the following:

    Fourth, Please open your project and open the nuget-package.

    Fifth, Please click theGears
    134922-image.png

    Sixth, Please click '+' , set the source of the nuget and click update and ok.

    134860-image.png

    Finally, you could choose Package source and install the nuget-package.

    134887-image.png

    Hope this could help you.


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2021-09-23T02:06:53.533+00:00

    The product group for Azure DevOps / TFS actively monitors questions over at
    https://developercommunity.visualstudio.com/report?space=21&entry=problem
    https://developercommunity.visualstudio.com/report?space=22&entry=problem

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.