Resharper 7: MSTest not working - “Test wasn't run”

夙愿已清 提交于 2019-12-03 23:34:22

As odd as it is, using VS2012, using Resharper 8.0, using NUnit, I was receiving this error because of an entry in my app.config file. I added an EntityFramework connection string and this behavior started. Removing the entire connection strings section shows the test runner starts/works again. Viewing output shows the app.config is not valid - this was causing this specific behavior in the test runner - "Test wasn't run".

I had the testproject set to AnyCPU and the project set explicitly to x86 when this happened. Setting the testproject to x86 solved it for me.

I'm using VS2012 R#8 and nUnit

Try running the Unit Tests using the MSTest Test Explorer. You might find more details in the output window of the root cause.

For me, it was a referenced assembly that was using a more recent version of NUnit than the one that was referenced in the test project. Using the same up-to-date version fixed the problem.

System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

I'd same problem I just..

  • Changed methods access modifier from private to public.
  • Removed static keyword from methods.

That's it. It worked for me. But that is for C#.

In my case it was the NUnitTestAdapter nuget that needed to be removed.

Check that any references that you have in the test project are set to Copy Local True.

I had the same problem. Couldn't get the Visual Studio test runner to work, so I tried debugging a test instead. This threw a ConfigurationErrorsException, which didn't have much of a stack trace but contained the phrase "ClientSettingProvider". I searched my solution and found that something had added a appSetting key for "ClientSettingProvider.ServiceUri" to my app.config. I deleted this (along with an empty connectionStrings element) and rebuild everything - fixed the problem!

Double check your app.config and try deleting any empty elements or anything that looks fishy.

Another (silly) problem it might be; I accidentally had the project set to not build. Go to Build/"Configuration Manager", and ensure the project is set to build.

Using VS2010 and ReSharper 9.1 the issue was that the file LocalTestRun.testrunconfig was missing but was referenced in my .vsmdi file.

The test without VS were running properly but I always had the "Test wasn't run" error in ReSharper test UI.

So I simply restored my old LocalTestRun.testrunconfig file and everything run perfectly.

I probably could have updated my .vsmdi file to not reference the missing file... I did not test that.

On VS2012, Test Project don't work on Shared Folders like \XXXXXX\XXX I solved it copied the Test Project on local devices. Good Luck

I found that the settings file for the unit test may need checking as to which one is being pointed to by ReSharper. I had the same thing happening and it was down to my unit tests for the RS Harness pointing to the wrong file.

I had the same issue because the test class name had the characters '<' and '>' in it (also '(' and ')' caused this issue).
Removing those symbols fixed the problem.

I could use symbols in identifiers thanks to F#'s Unicode support.

I had the exact same issue and nothing helped.

eventually I saw that I had a mismatch in my namespaces of the unit project and the unit test project.

The namespace of my unit project is unit.project and the test project was named unit.project.tests but the default namespace of the test was the same as the unit, both was unit.project.

Once I've updated the namespaces to be different (one namespace for each project) everything worked!

NagMacFeegle

I had a similar problem with NUnit test, which would not be executed, but R# would only mark them as "Test wasn't run".

Executing them with the native NUnit runner revealed, that the app.config file had an error (actually, 2 ConnectionString sections). Fixing this also made the tests running in R# test runner.

I kept getting "Test wasn't run" in Resharper.. I tried all the recommendations but nothing worked. What solved it for me was running Visual Studio as Administrator. (VS2013 w/ Resharper 8.1)

Just an excerpt from MSDN regarding Assert.Inconclusive:

The code generated by Visual Studio when creating unit tests includes an Inconclusive statement as a placeholder.

It happens if something is wrong with the solution, the most often a misconfiguration, like wrong or mismatched namespaces, inconsistent build targets etc, what leads to the fact that UnitTestExplorer is unable to use provided unit tests properly. So the general solution is to check latest changes and fix errors.

I had the same problem in C#: Unit tests run by ReSharper all just stopped with "Test wasn't run". No other information.

It turned out to be due to my custom section in App.Config. Removing that and it worked.

Configuration: Visual Studio C# 12, ReSharper 8.2.3

Just to add to this, I had written over my app.config file with a new one that was missing some sections I needed. I added the sections back in, at which point I got this same error in resharper. Thanks to the comments above I compared it to an older version and found that I was missing the section names in the configSections.

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