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

28,007

Solution 1

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

Solution 2

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

Solution 3

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.

Solution 4

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

Solution 5

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

Share:
28,007

Related videos on Youtube

magnattic
Author by

magnattic

Working mostly on the web. Passionate about technology and innovation.

Updated on September 15, 2021

Comments

  • magnattic
    magnattic over 2 years

    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?

    • ldsenow
      ldsenow over 11 years
      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.
    • ldsenow
      ldsenow over 11 years
      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.
    • ldsenow
      ldsenow over 11 years
    • Johan Larsson
      Johan Larsson over 10 years
      I get this with nUnit and R#8
    • Cirem
      Cirem almost 10 years
      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?
    • Michael Freidgeim
      Michael Freidgeim about 6 years
  • BClaydon
    BClaydon over 10 years
    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!
  • Aaron
    Aaron about 10 years
    Same here, Good Call.
  • Sam Plus Plus
    Sam Plus Plus almost 10 years
    That was it for me. Basically any error in the app config seems to cause this.
  • magnattic
    magnattic over 9 years
    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.
  • Andreas Vendel
    Andreas Vendel over 9 years
    I also had this issue with an error in machine.config.
  • Rohit Sachan
    Rohit Sachan over 9 years
    Same with me, changed to x86 and it worked. but its disappointing that resharper is not giving correct error.
  • Gluip
    Gluip about 9 years
    same here...removing app.config fixed it
  • ilter
    ilter about 9 years
    Would you like to share with us what you did exactly? You finding what you were missing, not helping anyone...
  • Klaus Nji
    Klaus Nji almost 6 years
    Who would have thought. That's exactly the same problem here.