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

29.9k views Asked by At

Since I upgraded to VS2012 and Resharper 7, my previously working MS Tests are not running anymore.

enter image description here

The tests are run in an ASP.NET environment. I use the following Attributes:

    [TestMethod]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("C:\\Projekte\\****\\Website", "/")]
    [UrlToTest("http://localhost:7924/")]

Any idea how to fix this?

19

There are 19 answers

0
Alexey Khoroshikh On

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.

0
user466512 On

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

0
Kell S On

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

0
Leo Gurdian On

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)

0
silver On

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!

1
Philippe Langevin On

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.

The .vsmdi and LocalTestRun.testrunconfig files are managed by Visual Studio and are typically located beside you .sln.

0
vts123 On

It could be also that Your solution contains multiple versions of i.e. nUnit installed in different projects. In my case this was the reason of the problems. After unifying the nUnit version in the solution, the problem was gone.

0
MasterMastic On

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.

0
Tom_Granados On

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.

1
NagMacFeegle On

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.

0
Dark Knight On

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#.

0
SturmUndDrang On

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.

0
Russ On

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

0
emp On

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.

0
Jose Medrano Jimenez On

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

1
schwaber On

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.

0
JamesDill On

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.

6
barrypicker On

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".

1
Johan Larsson On

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