I am unable to associate test methods to test cases in the Test Explorer (the "Associate to Test Case" option is greyed out), or via MTM, or the VSTS website. I simply cannot find a way to associate tests to the test cases for automated testing.
I am using .NET core app 1.1, ASP.NET using MSTest (though I have tried Xunit as well, to no avail). Even a basic test case that always passes cannot be associated.
In MTM, I have created a test plan that has the Automation Status set to "Plan".
In VSTS, I have a project using a Git repository, in which I have a CI build created that successfully discovers, runs and reports the tests.
I cannot find where to associate these specific tests to test runs. How may I accomplish this?
Refer to these steps to associate test method to test case:
Another way is that you can associate the test method with test case through Update a field REST API.
For example:
PATCH https://[account].visualstudio.com/DefaultCollection/_apis/wit/workitems/[testcaseid]?api-version=1.0
Content-Type:
application/json-patch+json
Body:
The AutomatedTestId is a Guid value, so you can generate a new Guid by using this C# code: