Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Resharper not pick up my NUnit tests?

Tags:

I recently converted from MSTest to NUnit. I did this by

  • replacing all occurrences of [TestMethod] by [Test], [TestClass] by [Test], etc.
  • I also deleted the Microsoft.VisualStudio... reference and added the NUnit.framework nuget package.

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.

like image 481
taylonr Avatar asked Nov 14 '11 03:11

taylonr


People also ask

Why are my NUnit tests ignored?

Ignored tests are displayed by the runners as warnings in order to provide a reminder that the test needs to be corrected or otherwise changed and re-instated.

How do I run unit tests with ReSharper?

Right click on the project or solution in the VS solution-explorer and choose 'Run Unit Tests' Or go to the Resharper menu, choose Unit-Testing and choose one of the options from there.


2 Answers

I had the same problem and i solved it like this:

  1. Go to Resharper Options -> Tools -> Unit Testing -> Unit testing providers
  2. Unselect anything but Nunit and press OK.
  3. It should work now and you can even reselect the providers that you disabled and it should still work.
like image 145
Oren Avatar answered Oct 18 '22 21:10

Oren


Removing the .ReSharper.user file from the source directory (in the same directory as the solution file) solved the same problem for me.

like image 32
Michiel Overeem Avatar answered Oct 18 '22 23:10

Michiel Overeem