Resharper Unit Tests not running

℡╲_俬逩灬. 提交于 2019-12-03 02:28:33

I think restarting the whole system may have been a little premature. I have found when this happens all you need to do is restart Resharper.

I usually do this from the Command Window in Visual Studio , you just need to type these commands one after the other

Resharper_Suspend
Resharper_Resume

this generally fixes the problem for me and doesn't require reopening the solution.

If this fails you can clear the resharper caches. Information can be viewed here on how to do that.

here is how to do it from VS menu

Make sure you aren't doing what I was doing and completely forget that solution is in release mode with test project set to build only in debug mode ;-)

There was a bug in ReSharper 2017.3.1, which was fixed in 2017.3.2: https://blog.jetbrains.com/dotnet/2018/02/01/resharper-ultimate-2017-3-2-bugfix/

You can update using ReSharper > Help > Check for Updates.

You can see if you had the same error by enabling logs. This is what I had:

--- EXCEPTION #2/2 [LoggerException]
Message = “Passed version string '2.1.101' doesn't look to be a valid .net core sdk version”

And eventually:

|W| UnitTestLaunch | System.NullReferenceException: Object reference not set to an instance of an object.
at JetBrains.ReSharper.UnitTestProvider.nUnit.v30.NUnitServiceProvider.GetRunStrategy(IUnitTestElement element)
at JetBrains.ReSharper.UnitTestProvider.nUnit.v30.Elements.NUnitElementBase.GetRunStrategy(IHostProvider hostProvider)
at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.BuildStage.CollectProjectsToBuild()
at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.BuildStage.Run(CancellationToken token)
at JetBrains.ReSharper.UnitTestFramework.Launch.UnitTestLaunch.RunStage(Object stageObject)

My project is using NET471, and I run ReSharper 2017.3.1 in Visual Studio 15.6.27428.2005

This also happened to me, and found the reason in here: http://www.henrikbrinch.dk/Blog/2012/02/15/Making-Resharper-testrunner-work-in-64-bit

This fix is actually harsh, and what I did is change the configuration: VS2015 -> Resharper -> Options -> Unit Testing -> Default platform architecture - Force tests to run in 32-bit process

Hope this will help you

Happened to me today and none of the above suggestions (clearing cache, restarting VS, suspend/resume of resharper) worked.

However in the Unit Test Sessions tab under Error I could see I had a TypeLoadException which allowed me to pinpoint the problem.

I periodically run into this because I work on a project with multiple branches and switch between them without shutting down Visual Studio. This will occasionally confuse ReSharper and I will no longer have the NUnit options on some projects.

In Visual Studio Community 2017 with ReSharper 2018.2 the first thing I try is to Unload the project where the NUnit test runner is not available. Sometimes that is the only needed step.

Next I use ReSharper->Options->General->'Clear caches' which requires a VS restart.

Then I unload and reload the misbehaving project again.

This fixes the issue.

It seems there was a bad config /somewhere/. I reinstalled the entire sysetm, followed by VS2013 and R#. The tests now run fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!