Search code examples
c#visual-studiounit-testingautomated-testsvisual-studio-2019

How to recognize what unit testing framework is used in a project in Visual Studio, .NET?


I am working with a Visual Studio C# project and I need to know what unit testing framework is it using, but there is no one to ask about it.

How could I check it?


Solution

  • The most reliable thing here would be to look at the project references that the test project has (either in the IDE by expanding "References" in the solution explorer, or by looking at the csproj directly). You will probably find something like xunit, nunit, mstest, or something else indicative of what you're using.

    Note that this will often be in addition to Microsoft.NET.Test.Sdk, which is related to just making it testable; for example, I have an xunit project that includes:

        <PackageReference Include="xunit" Version="2.4.1" />
        <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
    

    The bottom two are for integration purposes; the top one is the actual test framework reference.