Skip to content

Provide ManagedType/ManagedMethod VSTest properties #1259

Closed

Description

@Youssef1313

@OsirisTerje I'm planning to remove the vstestprovider capability from VSTestBridge. This removal will (for now - this may change in future) require frameworks that use the bridge to provide the ManagedType/ManagedMethod properties. Would you have any soon plans to add that?

Activity

  1. OsirisTerje commented on Apr 16, 2025

    @OsirisTerje
    Member

    Currently no, but I have to admit I haven't looked into the different possibilities we have with the VSTestBridge.

  2. Youssef1313 commented on Apr 16, 2025

    @Youssef1313
    ContributorAuthor

    @OsirisTerje Let me expand more. Usually in MTP there is TestMethodIdentifierProperty. Currently we don't provide it in the bridge, and without ManagedType/ManagedMethod, we don't have a good way to provide it. For you, that will mean any extension trying to make use of that information won't work with NUnit.

  3. OsirisTerje commented on Apr 29, 2025

    @OsirisTerje
    Member

    Can you point me to some documentation on the ManagedType/ManagedMethod? Is this the same as the older FQN system you have?
    What are we missing - I believed you already got that information from NUnit ?

    So what you're saying is that the adapter will no more be the item that supports the MTP, but it has to be built into the framework ?

  4. Youssef1313 commented on Apr 29, 2025

    @Youssef1313
    ContributorAuthor

    @OsirisTerje So, to give a bit of history, Test Explorer used to use FullyQualifiedName to determine the source information for test cases. But this was never standardized, which makes it harder to use to provide source information. Later, a spec for ManagedType/ManagedMethod was introduced (putting aside that it could have been designed in a better way).

    Today, there are public helpers exposed via AdapterUtilities package (https://github.com/microsoft/vstest/blob/2e6d9288d3aa0269ae710844f3aa9e0a3981b26e/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs#L14) that helps construct ManagedType/ManagedMethod given MethodInfo.

    The properties are expected to be defined like this, then set normally as any other VSTest property.

    On VSTestBridge, this will allow us to be able to:

    1. Correctly add TestMethodIdentifierProperty, which can be accessed by MTP extensions (e.g, test loggers like what I started in Add support for Microsoft.Testing.Platform spekt/testlogger#172 (see here)
    2. Be able to drop vstestProvider from VSTestBridge. So far, Test Explorer provides source information for NUnit by using FullyQualifiedName, which has some tricks on Test Explorer side that can't be easily replicated on MTP side. With ManagedType/ManagedMethod, it will be easier for VSTestBridge to be able to create TestMethodIdentifierProperty and finally drop vstestProvider.
  5. OsirisTerje commented on Apr 29, 2025

    @OsirisTerje
    Member

    @Youssef1313 Ok, those are added in the adapter - that is good, and it seems trivial to get those in. Thanks for those links.

    You are aware that the naming of NUnit tests are much wider (in syntax) than what FQN will allow? We have a lot of issues related to that, and have been trying to force the names into some sort of FQN, but it is like squeezing a football into a keyhole.....
    Some of the issues are here: https://github.com/nunit/nunit3-vs-adapter/issues?q=is%3Aissue%20state%3Aopen%20label%3Ais%3AFQNIssue

    Could we just add the real NUnit test name into the ManagedMethod property ?

    How does this play out with the Real Time Discovery feature?

    And to answer your question at the top - we should be able to get this into the 5.1 adapter. I'll try to get it done during the long weekend now.

  6. Youssef1313 commented on Apr 30, 2025

    @Youssef1313
    ContributorAuthor

    You are aware that the naming of NUnit tests are much wider (in syntax) than what FQN will allow?

    I didn't dig into all the possible shapes of FQN that NUnit can produce, but I knew that NUnit specifically is a bit different in this area than MSTest and xunit.

    Could we just add the real NUnit test name into the ManagedMethod property ?

    Use of ManagedMethod should be done together with ManagedType (both should be set - not one of them), and they must strictly be calculated by ManagedNameHelper in AdapterUtilities.

    How does this play out with the Real Time Discovery feature?

    Likely no impact for real-time discovery.

  7. added
    MTP
    on May 5, 2025
  8. OsirisTerje commented on May 25, 2025

    @OsirisTerje
    Member

    @Youssef1313
    You wrote:

    I'm planning to remove the vstestprovider capability from VSTestBridge. This removal will (for now - this may change in future) require frameworks that use the bridge to provide the ManagedType/ManagedMethod properties.

    1. Does this mean you expect these to be done in the NUnit Framework ? If so, I am not sure if that will happen @manfred-brands @stevenaw @jnm2
    2. They can be added in the adapter, or in a NUnitLite (NextGen) extension for dotnet test. Is that what you expect ?
  9. Youssef1313 commented on May 28, 2025

    @Youssef1313
    ContributorAuthor

    If we will remove vstestProvider, then yes we expect these properties to be provided by NUnit. To be more precise, we expect it to be available at this point.

  10. Youssef1313 commented on May 28, 2025

    @Youssef1313
    ContributorAuthor

    Keep in mind that VSTestBridge will never add TestMethodIdentifierProperty if ManagedType/ManagedMethod are not available.

    So any extensions that will make use of TestMethodIdentifierProperty are not going to work with NUnit.

  11. added
    closed:SomebodyElsesProblem
    on Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MTPclosed:SomebodyElsesProblemis:enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions