Skip to content

Investigate test case association feature and its support with MTP #4477

Description

https://learn.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops

It looks like this feature may be working by setting a VSTest property on TestCase, which means it may not work with MTP.

We need to investigate further.

Activity

  1. added
    area/mtp
    on Apr 28, 2025
  2. JoaoAntunes8210474 commented on Jul 2, 2025

    @JoaoAntunes8210474

    Youssef Fahmy (@Youssef1313) Hello sir, hope you are doing well!

    Would you be able to give any information or any plans/dates for this feature being supported by MTP?

  3. Youssef1313 commented on Jul 2, 2025

    @Youssef1313
    MemberAuthor

    Hi JoaoAntunes8210474

    Unfortunately we didn't yet investigate what's needed to support this in MTP.

  4. JoaoAntunes8210474 commented on Jul 3, 2025

    @JoaoAntunes8210474

    Hey Youssef Fahmy (@Youssef1313), hope you are doing well!

    Would you be able to let me know if investigating how to support this feature in MTP is something that's planned for the near future?

    It's a somewhat important feature for integrating tests with Azure DevOps' test cases.

  5. nohwnd commented on Jul 3, 2025

    @nohwnd
    Member

    I don't have the technical details, I've reached out to ADO team to see if they can point me to the code that does it.

  6. JoaoAntunes8210474 commented on Jul 18, 2025

    @JoaoAntunes8210474

    Jakub Jareš (@nohwnd) Hello sir, hope you are doing well!

    Would you happen to have any updates regarding contacting the ADO team for information over how this feature was previously supported on VSTest?

  7. nohwnd commented on Jul 21, 2025

    @nohwnd
    Member

    I got the supposed locations of the code, but did not get to investigate it yet, I will at best get to it next week.

  8. Youssef1313 commented on Jul 21, 2025

    @Youssef1313
    MemberAuthor

    Related to #5951

    I assume the general flow that users do is:

    • Associate test cases in Test Explorer to AzDO test case, and an AzDO test case is part of a test plan.
    • Use VSTest AzDO task to run a given test plan by specifying testSelector: 'testPlan' and then specify the test plan they want to run.

    What we need to do for MTP to support this:

    1. Update Visual Studio to support associating test cases to AzDO test cases for MTP. We have a whitelisted set of adapters that we should include testingplatform-bridge in.
    2. The NuGet package Microsoft.TeamFoundationServer.Client has APIs related to test plans. We need to figure out the exact API we need that exposes test cases in a given test plan (hopefully there will be something there in that package?).
    3. We don't implement the support in an AzDO task. Instead, we create an AzDO test plan extension.
      • The test plan AzDO extension package will have a dependency on MS.TFS.Client
      • When the user specificies --azdo-test-plan, we will query the test plan, and use AddTestExecutionFilterFactory to construct a filter. But here, we will face an issue, as filters are not very well standardized, except for test node uids. I'm guessing that on VSTest, there was a special casing for MSTest/NUnit/xUnit when the filter is constructed.
  9. JoaoAntunes8210474 commented on Jul 21, 2025

    @JoaoAntunes8210474

    Youssef Fahmy (@Youssef1313) The general flow you described is precisely the most common way we use the feature in our company.

    We also have a dozen or so Azure Pipelines running tasks to request from the Azure DevOps API information on which test cases have the Automated status. Which is why this feature is very important to us (although we are probably not the only ones using the feature in this way).

  10. JoaoAntunes8210474 commented on Aug 11, 2025

    @JoaoAntunes8210474

    Jakub Jareš (@nohwnd) Hello sir, hope you are doing well!

    Would you be able to tell us if you've had the opportunity to investigate this issue?

  11. Youssef1313 commented on Aug 11, 2025

    @Youssef1313
    MemberAuthor

    Unfortunately, we didn't yet prioritize an implementation for this feature.

  12. Youssef1313 commented on Aug 11, 2025

    @Youssef1313
    MemberAuthor
  13. elgatov commented on Aug 26, 2025

    @elgatov

    This is preventing a very simple derived test method attribute from being associated with Azure Test Plans:

    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System;
    using System.Collections.Generic;
    
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class RetryingTestMethod : TestMethodAttribute
    {
        private int retries;
    
        public RetryingTestMethod(string testName, int retries) : base(testName)
        {
            this.retries = retries;
        }
    
        public override TestResult[] Execute(ITestMethod testMethod)
        {
            var testResults = new List<TestResult>();
            do 
            {
                testResults.AddRange(base.Execute(testMethod));
            } while (--retries > 0 && !testResults.Exists(r => r.Outcome == UnitTestOutcome.Passed));
    
            return [.. testResults];
        }
    }
  14. 6 remaining items

  15. nohwnd commented on Dec 18, 2025

    @nohwnd
    Member

    shepherdm3 Moved the UI issue here, microsoft/vstest#15348 let's discuss there, to not pollute this issue with it.

  16. shepherdm3 commented on Dec 18, 2025

    @shepherdm3

    This issue can be closed.

  17. jangroendus commented on Dec 31, 2025

    @jangroendus

    I would like to thumb up this issue

  18. added
    area/mtp-migration
    on Jan 1, 2026
  19. JoaoAntunes8210474 commented on Jan 19, 2026

    @JoaoAntunes8210474

    This issue can be closed.

    Does MTP now support integrating test cases with Azure DevOps' test cases in Visual Studio?

  20. Youssef1313 commented on Jan 19, 2026

    @Youssef1313
    MemberAuthor

    No, it's not yet supported for MTP.

  21. DanielGilOrtiz commented on Oct 7, 2026

    @DanielGilOrtiz

    Adding a concrete CI scenario in case it helps prioritize this.

    Setup: MSTest.Sdk 4.4.1 / MTP 2.4.1, dotnet test on ubuntu-latest, results published with --report-azdo --publish-azdo-test-results. We'll set the test case associations in Azure DevOps directly (REST), so we don't depend on the Test Explorer part of this issue. We only need the pipeline to update the test plan.

    Gap: for .NET, the only supported route today is VSTest mode on a Windows agent, i.e. leaving MTP:

    • --publish-azdo-test-results (as of 2.4.1) creates standalone runs, with no plan or test point options.
    • VSTest@3 (testSelector: testPlan) doesn't support MTP and only runs on Windows agents.
    • AzureTestPlan@0 supports Java, Python and JavaScript only.

    What would unblock us: only the outcome write-back, as part of live publishing (option names are just illustrative):

    dotnet test --project Tests.csproj --report-azdo --publish-azdo-test-results \
      --publish-azdo-test-plan 1234 \
      --publish-azdo-test-suite 5678   # optional, defaults to all suites in the plan
    1. Read the plan's test points and each test case's Microsoft.VSTS.TCM.AutomatedTestName.
    2. Match it against the automatedTestName already published (the FQN since Fix Azure DevOps published test identity #10706).
    3. Create a run with plan + pointIds and post one result per point. Data rows share one AutomatedTestName, so use the worst outcome across rows, taking each row's final retry attempt.
    4. In this publish-only mode, leave points without a result untouched: the run may be filtered (--filter), so a missing result shouldn't overwrite the point's last outcome.

    Matching on the association rather than [WorkItem] / [TestProperty("TestCase", …)] (item 5 of the #5951 brainstorm) needs no code changes, and it's the same key VSTest@3 uses.

    Happy to test a preview build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/mtparea/mtp-migration

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions