c# Resharper 'No Tests Found in Project' / 'Inconclusive: Test wasn't run'
Asked Answered
P

6

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.

Pasteur answered 6/11, 2014 at 20:14 Comment(7)
No. The best work around I've come up with is: let my coworkers run the unit tests.Pasteur
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?Burkley
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 @Burkley suggestion everything started working like a charm.Votyak
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. :(Pasteur
I was having this issue and rebooting my computer fixed it.Mantissa
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.Pasteur
If you landed here looking for this problem in Resharper 9, it's a known issue: youtrack.jetbrains.com/issue/RSRP-429003#comment=27-913901Kindliness
G
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).

Gloaming answered 21/1, 2015 at 11:54 Comment(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.Gloaming
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.Enough
W
3

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

Wehner answered 6/1, 2015 at 19:8 Comment(0)
E
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.

Ethban answered 16/2, 2015 at 16:23 Comment(2)
@Pasteur If you didn't try it, how do you know it won't help?Licensee
@Caner Öncü i hadn't tried it at the time. i've tried it since. it didn't help. ;)Pasteur
D
2

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

Danelaw answered 15/5, 2015 at 10:4 Comment(1)
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.Omission
P
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.

Prose answered 16/7, 2015 at 10:14 Comment(0)
I
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.

Infantry answered 21/2, 2020 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.