Reputation: 10790
I recently converted from MSTest to NUnit. I did this by
[TestMethod]
by [Test]
, [TestClass]
by [Test]
, etc.Since I've done that, Resharper isn't showing the little testing icon next to the methods. And if I run the tests using Ctrl + U, R it shows the right count but doesn't actually run any of them.
Does anyone have any idea?
Edit: There must be something screwed up with my assembly because I created a new one just called Test.Web and created a simple class with just the [TestFixture] and Resharper recognized it instantly.
Upvotes: 30
Views: 23834
Reputation: 7474
I had just a handful of tests showing (XUnit in this example but not sure if that makes a difference).
I went to the root level in the Unit Test Sessions folder hierarchy → right-click → Append All Tests from MySolution and voilà! they all finally appeared. :-)
Upvotes: 0
Reputation: 31
This can also happen when NUnit upgrades to a new version (like with 4.0 released on 11/26/23) and R# hasn't caught up. I'm probably the only one dumb enough to upgrade NUnit then wonder why it's not working, but maybe this helps someone else.
Upvotes: 2
Reputation: 748
Another thing to try is to open the Unit Test Explorer (Resharper > Unit Tests > Unit Tests) and click the Refresh button in the upper left corner. This caused missing unit tests to reappear for me in both the Unit Test Explorer and the All tests from Solution session.
Upvotes: 0
Reputation: 1365
Update to latest version of resharper and add the location of the applications root directory in you ".testsettings" file
Upvotes: 0
Reputation: 509
This was happening in one solution with a large number of projects. (I checked, and it had not paused analysis.) Running tests in all my other solutions worked fine. I tried adding the NUnit 3 Test Adapter package to all my projects, but since I am using Resharper, I was pretty sure that wouldn't fix anything - it didn't. Finally I updated to the latest version of Resharper. The installer said it failed, but after that, Resharper could once again see my unit tests. Hard to say whether this could qualify as an "Answer" but it seems to be what got me back up and running.
Upvotes: 0
Reputation: 472
This problem can occur if you have multiple test projects with mismatched versions of nunit, NUnit3TestAdapter and Microsoft.NET.Test.Sdk.
When I added a new test project to an existing solution, Visual Studio installed the very latest versions of these libraries by default. All tests worked in the built in Test Explorer, but ReSharper could not see the new test project.
To fix: Right click on the solution in Solution Explorer, choose "Manage NuGet Packages for Solution", then go to the Consolidate tab. Pick the version that you want to use for each of these libraries and install it in all test projects.
Upvotes: 0
Reputation: 1901
I got this working by following the suggestions on this StackOverflow question. Specifically:
Microsoft.NET.Test.Sdk
Upvotes: 3
Reputation:
For me, right-clicking on the test fixture class name and clicking the Visual Studio's (not Resharper's) "Run Tests" menu item made the R# icons show up again.
P.S. This was in Visual Studio 2017
Upvotes: 5
Reputation: 147
I had the same problem and i solved it like this:
Upvotes: 13
Reputation: 10790
There was a problem with the assembly. I'm not sure what. But I created a new blank class library, installed NUnit, Should and Moq. Then copied my classes from the previous assembly into the new one and voilá, everything worked.
Upvotes: 3
Reputation: 8693
This can happen when the test class is so large that ReSharper pauses code analysis. For these files, you can right-click on the "pause" icon above the code editor's vertical scrollbar and select "Resume Analysis".
This will add a ForceIncluded
entry to the solution's .DotSettings.user
file, so you won't need to do it again:
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=.../@EntryIndexedValue">ForceIncluded</s:String>
Upvotes: 1
Reputation: 649
I had a problem when it just stopped working for some reason.
The solution was to go Resharper->Options->Tools->"Unit Testing" in each sub item like NUnit, you will go and set checkbox for the tests you want to support. There will be something like "Enable NUnit 3x support".
Like this:
Upvotes: 2
Reputation: 1131
I experienced a similar issue and determined that the MSpec plug-in was interfering. Resolved by disabling MSpec test runner: Resharper->Options->Plugins.
Upvotes: 0
Reputation: 3992
Removing the .ReSharper.user file from the source directory (in the same directory as the solution file) solved the same problem for me.
Upvotes: 15