26

I've got ReSharper v8.2.1 installed. I have a VS2013 solution that contains several test projects. Most of them work just fine. However, one project is giving me trouble.

In the Solution Explorer, I right-click the project and select "Run Unit Tests" and get the error "No Tests Found in Project." If I right click on one of the .cs file that contain tests and select "Run Unit Tests," I get the error "No Unit Test Found in File." If I open the file, I see the test icons as expected:Resharper test icons

After opening the file and running the test, it finally adds them to the Unit Test Sessions window. But they all come up as "Inconclusive: Test wasn't run." I tried setting breakpoints in the test and also in the TestInitialize method, but neither are hit.

It is worth mentioning that these test worked just fine until recently. It seemed to start after I cancelled a long-running test in another project. But there are no code or project or solution changes. I deleted my source code and got it fresh from SVN. I even deleted my AppData\Local\JetBrains folder to make sure something wasn't cached.

How does Resharper determine which tests it should run? Anyone have other suggestions for getting these tests to run again?

Update: I uninstalled ReSharper to eliminate it from the equation. I was still unable to get this subset of unit tests to run.

Then, in Visual Studio, I opened TEST -> Test Settings -> Default Processor Architecture and changed it from x86 to x64. My tests would now run! I still haven't isolated why this one project won't run in x86 mode, but I was happy to have all my tests running again!

However, I then re-installed ReSharper, this time v9.0 Update 1, and now this unit test won't run again regardless of how I set the architecture. I went back through all the answers and suggestions of clearing caches, etc, and still no luck.

djs
  • 1,660
  • 1
  • 17
  • 35
  • No. The best work around I've come up with is: let my coworkers run the unit tests. – djs Nov 19 '14 at 14:55
  • 1
    Ouch, worst work around ever. Did you try to simply delete all bin folders, do a clean rebuild, delete DotSettings.user and suo files and retry? – Keysharpener Nov 19 '14 at 15:01
  • In my case after changing the TargetFramework from v4.0 to v4.5.1 Resharper was not even displaying the test icons beside the test methods. After following @Keysharpener suggestion everything started working like a charm. – Marcel Gosselin Dec 03 '14 at 13:48
  • As I mentioned in my original post, I deleted my entire source code tree and got it fresh from source control. I also went into my AppData and blew away my Resharper settings. Still no good. :( – djs Dec 03 '14 at 15:36
  • I was having this issue and rebooting my computer fixed it. – odyth Jan 01 '15 at 21:49
  • I'm trying all suggestions in the answers and comments. (Actually, I'd tried all of the things listed so far before I posted the question.) I will definitely accept an answer if it works for me. – djs Feb 05 '15 at 15:18
  • 1
    If you landed here looking for this problem in Resharper 9, it's a known issue: https://youtrack.jetbrains.com/issue/RSRP-429003#comment=27-913901 – CAD bloke Mar 03 '15 at 21:20

6 Answers6

34

Try clearing the ReSharper caches. In Visual Studio, click on Resharper/Options. You can find the "clear caches" button in the "Environment" settings ("General").

Then close/reopen Visual Studio.

This worked for me (R# 9 with VS 2013 Update 4).

Marcel Studer
  • 581
  • 8
  • 9
  • 2
    What also helped me was to empty the "TestResults" folder (in the source directory), then close all unit test sessions (right click on the active unit test session and select "close all") and then execute the steps above. – Marcel Studer Feb 06 '15 at 11:14
  • After doing this I got a different error and then by changing my test settings architecture as per the OP my problem is now solved. I just wanted other to be aware that the fix may not be just a one-step solution. – Austin Thompson May 28 '15 at 15:13
3

Try closing visual studio and then right click and run visual studio as an administrator.

2

Going to Resharper -> Options -> Tools -> Unit Testing -> and remove check from "Shadow-copy assemblies being tested". I've tried all the things you have, nothing helped, this was the only thing that helped me resolve.

Let me know if this helps.

Igor Meszaros
  • 2,081
  • 2
  • 22
  • 46
2

Remove the test project from the solution and add it back. It works for me.

Lina
  • 21
  • 3
  • I have seen this kind of "magic" workaround work in other situations. Turns out the Project GUID is calculated based on the directory. if you move the project, it does not re-generate the GUID, but it _may_ care. Dropping/Adding the project recalculates the GUID. I have no idea why Visual Studio would care. – Jesse Chisholm May 22 '15 at 21:10
1

Searching for things to do with SpecFlow was leading my to lots of red herrings.

The problem for me in the end was that I had not configured resharper to run NUnit tests.

Do this by going into [Resharper] > Options | Tools, Unit Testing, NUnit

Then make sure Enable NUnit support is selected.

4imble
  • 13,979
  • 15
  • 70
  • 125
0

This suddenly happened for me on test projects the previously worked fine. The solution for me was to change Target Framework on the test projects from .NET Core 2.0 to .NET Core 3.1.

Reyhn
  • 997
  • 1
  • 11
  • 22