6

I am using JetBrains Rider to run unit tests for a .net Core project. And for some reason, it is failing to recognize any of the test cases in the solution.

These test cases were being detected before and now suddenly they are not. I restarted the Rider and rebuilt the solution and it seems that the problem does not go away.

Any suggestions on how to debug this?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Lost
  • 12,007
  • 32
  • 121
  • 193
  • 1
    Try looking in the backend.log for some obvious reason. Otherwise, submit a ticket to Rider team with Help->`Report a Bug`, agree to attach logs. – Ivan Shakhov Apr 21 '21 at 05:49
  • Not sure if this is a solution, but when clicked `Build selected projects` on unit test project, `Run unit tests` button wasn't disabled anymore – Nika Nabakhteveli Jul 18 '22 at 15:02

5 Answers5

2

I had exactly this problem with Rider a while ago. My teammates could still run our NUnit tests (both in Rider and Visual Studio) but I couldn't. The Run Unit Tests menu items were all disabled and the run icons that usually appear in the left margin alongside the test fixture class and test methods didn't appear.

It turned out to be a bug in Rider causing an incompatibility between versions of .NET Core and the Microsoft.NET.Test.Sdk library. I'd run the Visual Studio Updater and my teammates hadn't, so I was on the latest version of .NET Core and they weren't.

Here's the bug I filed with JetBrains. As you can see, they migrated it to ReSharper but the bug affected Rider too. Although it was fixed at the time I think I've seen it again since.

To find out if you've got the same problem, try the following:

  • Make sure .NET (Core) and the Microsoft.NET.Test.Sdk library are both up-to-date.
  • If this doesn't work, downgrade Microsoft.NET.Test.Sdk to an older version (anything before 16.3.0 worked for me).
Mark Whitaker
  • 8,465
  • 8
  • 44
  • 68
2

I had a similar problem where Rider (2023.1.3) disabled the Run Unit Tests option when right-clicking on a Test project in the Solution Explorer.

The fix for me was to go into the Test project and right-click on an individual test file and I could run that test.

Then the project was magically testable again.

DeanOC
  • 7,142
  • 6
  • 42
  • 56
1

I had a similar problem with Rider 2023.1.3. Run/Debug Unit Test options were disabled for some test classes, besides these classes were not displayed in the Unit Tests Explorer and they are disappeared from test session.

File -> Invalidate Caches... and restarting of Rider resolved the problem.

eugeny-pol
  • 11
  • 1
0

We had that problem and we use MSTest. We tried rebuilding, cleaning, etc. and none of that worked. But the following did work.

  • Comment out '[TestClass]'
  • Rebuild

All the menus were back to functioning as expected. I hope that helps future me when I come back into this question in a couple of months.

BlackjacketMack
  • 5,472
  • 28
  • 32
0

In my case, there were Git conflicts in the .csproj file that I had not noticed. When I resolved the conflicts, Rider once again recognized the test file as before.

I had looked at the project view to see what files had errors, but none showed. Evidently, the merge conflicts were causing that issue, too.

bartonstanley
  • 1,167
  • 12
  • 25