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

19

26

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?

Dundalk answered 30/8, 2012 at 6:49 Comment(6)
I have the same issue. It was due to my website and test project are x64. I don't have solution for it. I currently use nunit as a workaround.Renitarenitent
I found out it might be Resharper's problem. I ran the tests from "Test -> Run" of VS and those tests were picked up. BTW, I changed the "Test -> Test Settings -> Default Processor Architecture" to x64. I think if you run them in the build server, it should be fine.Renitarenitent
This may help youtrack.jetbrains.com/issue/RSRP-326760Renitarenitent
I get this with nUnit and R#8Gurglet
I am experiencing this same problem with VS2013, ReSharper 8.2, and DotCover 2.7 trying to run on against a x64 solution. None of the below worked for me. Any other solutions?Untaught
Possible duplicate of Test method is inconclusive: Test wasn't run. Error?Merganser
W
19

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

Watercool answered 18/9, 2013 at 17:19 Comment(6)
This was exactly it for me. I jacked up my database connection string (had changed the name). I fixed that and my tests run again. Thanks!Affinity
Same here, Good Call.Misericord
That was it for me. Basically any error in the app config seems to cause this.Slone
I also had this issue with an error in machine.config.Tiphani
same here...removing app.config fixed itTolson
Who would have thought. That's exactly the same problem here.Remex
G
6

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

Gurglet answered 2/10, 2013 at 15:10 Comment(1)
Same with me, changed to x86 and it worked. but its disappointing that resharper is not giving correct error.Files
C
4

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.

Convulsion answered 15/11, 2013 at 12:25 Comment(0)
D
2

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

Dimitrovo answered 13/4, 2015 at 18:41 Comment(0)
Y
2

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

Yolanda answered 21/1, 2016 at 20:52 Comment(0)
O
1

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

Onwards answered 4/2, 2013 at 23:1 Comment(0)
G
1

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.

Greyhen answered 1/10, 2014 at 13:41 Comment(0)
C
1

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.

Cadet answered 7/10, 2015 at 8:27 Comment(0)
S
1

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.

Stepchild answered 1/8, 2017 at 18:55 Comment(1)
Your answer would be more helpful if you added how to locate these files.Nahtanha
H
0

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

Hebraist answered 2/1, 2013 at 18:12 Comment(0)
G
0

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.

Gynecocracy answered 18/2, 2014 at 11:39 Comment(0)
N
0

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.

Nettienetting answered 29/3, 2014 at 2:11 Comment(0)
C
0

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!

Clearheaded answered 3/8, 2014 at 8:42 Comment(0)
P
0

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.

Phenazine answered 5/11, 2014 at 7:30 Comment(1)
The question is specifically about MSTest. This still might be useful information for visitors having the problem with NUnit tests, but it should probably be a comment instead of an answer.Dundalk
A
0

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)

Accord answered 26/5, 2015 at 14:25 Comment(0)
A
0

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.

Abate answered 9/6, 2015 at 14:42 Comment(0)
C
0

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

Clomb answered 3/2, 2016 at 11:16 Comment(0)
S
0

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.

Shrubby answered 14/9, 2021 at 12:7 Comment(0)
H
-2

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.

Hanuman answered 1/5, 2015 at 21:24 Comment(1)
Would you like to share with us what you did exactly? You finding what you were missing, not helping anyone...Egoism

© 2022 - 2024 — McMap. All rights reserved.