Visual Studio 2019: MSTest unit tests are not running in Test Explorer

Problem

I have a unit test project in Visual Studio 2019. When I click Run All Tests, none of the tests run.

I looked in the Tests output window and saw a message that says:

Test project does not reference any .NET NuGet Adapter. Test discovery or execution might not work for this project.

It’s recommended to reference NuGet test adapters in each test project in the solution.

Solution

  1. Right-click on your test project
  2. Click Manage Nuget Packages
  3. Browse > search for MSTest.TestAdapter > click on MSTest.TestAdapter in the results > click Install

Now your MSTest unit tests will run.

7 thoughts on “Visual Studio 2019: MSTest unit tests are not running in Test Explorer”

  1. This didn’t work for me.
    All tests were running, when all of a sudden they started to show in light blue.
    I hate Microsoft every day a little more. Their products suck.

    Reply
      • I see there “Could not find schema information for the element ‘serviceRegistry'”. but on another computer its working well with the same properties “settings” on app.config.

        Reply
        • It sounds like this is an element in a custom schema. Try this:
          1. Click on app.config
          2. XML menu > Create Schema

          If that doesn’t work, could you show me the app.config?

          Reply
          • Create schema – Its working pretty well. I delete whole .sln from my disk and take latest .sln from server and original report “Could not find schema information for the element ‘serviceRegistry’” does not occurs, but …
            If I run test with attribute //[AllowLocalRun] there is no any information about RUN test. I Usualy have to by – “allow locall run to run test”. Is there som more detailed log to check whats VS is doing? Last time I reinstall whole VS 2019 too … I can send some info via email.

  2. I found:

    No test matches the given testcase filter `FullyQualifiedName=BonusHandling.BonusHandling_Bahniuk.DebitBonus01|FullyQualifiedName=BonusHandling.BonusHandlingTests.DebitBonus01|FullyQualifiedName=BonusHandling.BonusHandlingTests.DebitBonus02|FullyQualifiedName=BonusHandling.BonusHandlingTests.DebitB…` in C:\TFS\MSCP\PRODUCTS\Medio_AS-OCS\MAIN\Projects\AS-OCS_Services\Test\Autotest\!builds\release\net472\NVision.See.Autotest.TestBonusHandling.dll

    Reply
    • Were these tests working in an earlier version of Visual Studio using MSTest?

      1 – Make sure your tests have the right attributes for MSTest. Ex: [TestMethod]

      2. Make sure you have the updated test packages
      Microsoft.NET.Test.Sdk
      MSTest.TestAdapter
      MSTest.TestFramework

      Reply

Leave a Comment