No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again

90,115

Solution 1

This is a known issue for .Net 4.6 now.

Unable to run .Net 4.6.x unit tests as part of a XAML TFS Build with TFS 2015 UPdate1 Source:https://connect.microsoft.com/VisualStudio/feedback/details/2245723

Here is a similar question for you reference: Unable to run .Net 4.6 Unit tests of TFS 2015 XAML build server

Solution 2

You can try to change your default processor architecture in your Test Setting from X86 to X64. In my case this was the problem.

This happens if the platform target of your project under test is set to x64.

Screenshot of test settings

Solution 3

My build was not finding the tests either. My setup and solution for finding the tests are as follows.

I use VSTS (Visual Studio Team Services) and have a build that is configured to refresh the NUGET packages on every build. I am using NUnit and found that running the following NUGET command (from the package manager console in Visual Studio) to add NUnitTestAdapter library to my test project and the checking in the packages.config made the tests run in my VSTS build.

Install-Package NUnitTestAdapter

As Maurice mentions in the Comment to this post for NUnit3 use the following NUGET package (Look for other utils on the link. i.e: dotnet CLI and Paket CLI)

Install-Package NUnit3TestAdapter

Hope this helps.

Solution 4

In my case, I had to:

  1. Convert test project to netcore 2.0 (was netstandard 2.0)

  2. Add nuget package xunit.runner.visualstudio

Reference: http://www.neekgreen.com/2017/11/20/xunit-no-test-is-available/

Solution 5

I'm using MSTest. For me, it was version missmatch and missing another dependent package-

1) My package folder contains only MSTest.TestFramework.1.2.1 package. In my project file(.csproj) the reference in Target Name was MSTest.TestAdapter.1.2.0 package which was not present in package folder. My packages.config has also reference of MSTest.TestFramework.1.2.0 .

2) So I installed MSTest.TestAdapter.1.2.0 from nuget package manager and align MSTest.TestFramework version to 1.2.0 in project and package file. Finally I add Microsoft.VisualStudio.TestPlatform.TestFramework and Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions in the reference.

Then everything was OK. Hope this help someone.

Share:
90,115
Tore Østergaard
Author by

Tore Østergaard

Working actively with C#, C++ and Team Foundation server. By night I do a little hoppy development in php, MySQL, javascript and html.

Updated on July 08, 2022

Comments

  • Tore Østergaard
    Tore Østergaard almost 2 years

    I am in the process of upgrading our existing solution to .Net 4.6.1 and have been unable to get our unit tests to run during a server build. Locally they run as expected and flipping the framework version back to .Net 4.5.1 makes them run again on the server.

    I am getting the following error:

    No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

    I have reproduced the problem in a simpler setup:

    • Solution with a single C# Unit Test project with two tests (one failing, one passing).
    • XAML build definition using the Default Template (TfvcTemplate.12.xaml)
    • TFS 2015 Update 1 XAML build server with Visual Studio Enterprise 2015 Update 1 installed (have six similar servers and all produce the same result)
  • Tore Østergaard
    Tore Østergaard over 8 years
    Hi Patrick. Both of the links you supply is cases opened by me, so I wouldn't trust them as reference ;-).
  • Maurice Klimek
    Maurice Klimek over 6 years
    I'm also currently using VSTS. As adviced I added NUnit3TestAdapter (since I'm using NUnit 3.8.1) and this solution solved my problem. Thank you :-)
  • Tore Østergaard
    Tore Østergaard over 6 years
    My problem was with (on-prem) TFS 2015 Update 1 and it was fixed with Update 2. I am not sure if the same issue exist/existed with VSTS.
  • Amna
    Amna about 6 years
    same issue was with me. I am using xunit with .net core
  • Jeremy Thompson
    Jeremy Thompson almost 6 years
    I bumped into this with .Net 4.6.1 VS2017. I ended up rolling back to 1.2.0 - definitely make sure you dont have two different versions in your packages folder or in source control.
  • James Joyce
    James Joyce almost 6 years
    Mine appeared to find the tests, but yes, missing "MSTest.TestAdapter" was the real issue. No nice errors or warning (VS2017 15.8). All looked good except no tests were found, despite appearing in the test explorer..... So when I did "install-package MSTest.TestAdapter" suddenly my tests ran as expected. Thanks MS - 3 hours wasted...........
  • Thorkil Værge
    Thorkil Værge almost 6 years
    This also worked for me in Visual Studio 2017 with xunit and .NET Core 2.1.
  • Michael Levy
    Michael Levy over 5 years
    Yes! And don't forget to restart Visual Studio. That was required for me.
  • Bimal Das
    Bimal Das over 5 years
    Install-Package NUnit3TestAdapter solved my issue :)
  • Juan
    Juan about 5 years
    in my case was a .net 4.6.1 project so the only thing missing was the xunit runner. Installed it and worked.
  • Sean Kendle
    Sean Kendle about 5 years
    "At the top of the menu" what does that mean?
  • J Wood
    J Wood about 5 years
    @SaiyajinGohan. After you complete step 2, the "Extensions and Updates" window appears. At the top of this window, I saw the NUnit adapter was disabled. Hope this clarifies....
  • Sean Kendle
    Sean Kendle about 5 years
    Thanks for that, I still couldn't get this working with the project I was working on. Luckily it was a test project and the next one worked. Still a mystery as to why.
  • dixiashi
    dixiashi almost 5 years
    First things, you should make sure that the test case can be run in the VS IDE.
  • datchung
    datchung over 4 years
    This solved it for me. In my case, both the project being tested and the test project were set to x86. Tests were disoverable but failed to run. After I changed it to Any CPU, tests ran.
  • furman87
    furman87 over 4 years
    Installing the MSTest.TestAdapter 1.4.0 did it for me in VS 2019. I only wasted 30 minutes thanks to you.
  • David Yates
    David Yates over 4 years
    This did indeed bite me. I think the clue that this is happening is that it FINDS the unit test DLL, but it does NOT find any tests in it. I also found that putting this inline after your copy statements will let you inspect to see what WAS copied (here /app/tests is your target directory on the Docker image): RUN file="$(ls -al /app/tests)" && echo $file (see this post for more info on echo )
  • Allen
    Allen about 4 years
    I just had the same problem and this resolved it. I am also quite suspicious that this may have had a bad nego-synergistic effect on my main project references, which suddenly stopped loading a particular DLL, but have not conclusively determined this nasty side effect.
  • Premil
    Premil almost 4 years
    Same as Juan. Only the runner package was missing. Running this in the package manager for the test project solved it: install-package xunit.runner.visualstudio
  • rajibdotnet
    rajibdotnet over 3 years
    This actually worked for me after banging my head in so many directions and suggestions.
  • JohannSig
    JohannSig about 3 years
    Confirmed. Accidentally removed the runner.visualstudio nuget package (keeping the xunit one). Re-introducing it fixed this problem. Thanks!
  • Kevin
    Kevin over 2 years
    Updating MSTest.TestAdapter (2.1.2->2.2.7) and MSTest.TestFramework (2.1.2->2.2.7) fixed it for me. Thanks!
  • Admin
    Admin over 2 years
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.