Test method is inconclusive: Test wasn't run. Error?

130,181

Solution 1

It was a Resharper issue. In Resharper options->Tools->MSTEST, I unchecked the Use Legacy Runner and now it works.

Solution 2

Just in case none of the above options worked for anyone I fixed my instance of this error by noticing a corrupt entry in my App.Config due to a missing nuget package in the test project.

Solution 3

For me it was rather frustrating, but I've found solution for my case at least:

If your TestMethod is async, it cannot be void. It MUST return Task.

Hope it helps someone :)

Solution 4

I had the same issue with resharper and I corrected this error by changing an option:

Resharper => Options => Tools => Unit Testing

I just had to uncheck the option "Shadow-copy assemblies being tested"

Solution 5

I faced this problem in vs 2017 update 3 with Resharper Ultimate 2017.2

Restart vs or restart machine can't help.

I resolved the problem by clearing the Cache as follows:

    Resharper ->options-> Environment ->click the button 'Clear caches'

Update:

There is a button "error" (I find in Resharper 2018) in the upper right corner of the test window.

If you click the error button, it shows an error message that may help in resolving the problem.

To track the root of the problem, run Visual Studio in log mode. In vs 2017, Run the command:

      devenv /ReSharper.LogFile C:\temp\log\test_log.txt /ReSharper.LogLevel Verbose

Run the test.

Review the log file test_log.txt and search for 'error' in the file.

The log file is a great help to find the error that you can resolve or you can send the issue with the log file to the technical support team of Resharper.

Share:
130,181

Related videos on Youtube

Cybercop
Author by

Cybercop

Master student of Web Science. Block chain and Machine Learning enthusiast

Updated on December 04, 2021

Comments

  • Cybercop
    Cybercop over 2 years

    I have a test class and below I have posted a sample test from the test class

    namespace AdminPortal.Tests.Controller_Test.Customer
    {
        [TestClass]
        public class BusinessUnitControllerTests
        {
            private IBusinessUnitRepository _mockBusinessUnitRepository;
            private BusinessUnitController _controller;
    
            [TestInitialize]
            public void TestInitialize()
            {
                _mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>();
                _controller = new BusinessUnitController(_mockBusinessUnitRepository);
            }
    
            [TestCleanup]
            public void TestCleanup()
            {
                _mockBusinessUnitRepository = null;
    
                _controller.Dispose();
                _controller = null;
    
            }
    
            #region Index Action Tests
            [TestMethod]
            public void Index_Action_Calls_GetAllBusinessUnit()
            {
                _mockBusinessUnitRepository.Stub(x => x.GetAllBusinessUnit());
    
                _controller.Index();
    
                _mockBusinessUnitRepository.AssertWasCalled(x=>x.GetAllBusinessUnit());
            }
        }
    }
    

    When I run the project I get following screen enter image description here

    I checked the references and the test project has the reference to main project. Any idea why the test are not running or saying that they were inconclusive?

    Edit 1:

    I saw a post here and changed my test's setting's default processor architecture to X64 but it still doesn't work.

    • Chris Mantle
      Chris Mantle almost 11 years
      It's a known issue in ReSharper. There are some potential solutions here: stackoverflow.com/questions/12191352/….
    • Mark Walsh
      Mark Walsh almost 11 years
      Have you done a clean and rebuild? I remember there's some weirdness in VS2010 with losing references to assemblies after you've updated and rebuilt them.
    • Cybercop
      Cybercop almost 11 years
      @ChrisMantle I checked it out and changed my default processor architecture, but it still doesn't work
    • Cybercop
      Cybercop almost 11 years
      @MarkWalsh I'm using VS2012. I still cleaned and rebuilt the solution as you said, but still doesn't work
    • Mark Walsh
      Mark Walsh over 10 years
      Have you tried restarting the OS (Last shot)
    • Cybercop
      Cybercop over 10 years
      Yea. What actually happened is I before had a other project's(domain model) in application. Now those project are provided as NuGet package. But I have installed the Nuget package. The application runs fine, its just the Test that is not running or says inconclusive
    • Jaider
      Jaider over 8 years
      Since ReSharper is giving me a hard time. I decided to quickly test it with NUnit3 Test Adapter visualstudiogallery.msdn.microsoft.com/…
    • gnat
      gnat about 5 years
      this question is discussed at meta
  • Spikeh
    Spikeh over 10 years
    This sorted it for me, after looking at a load of other fixes. I'm using VS 2013 and R# v8.1
  • Geoffrey Hudik
    Geoffrey Hudik about 10 years
    Same issue here. It would be nice if R# would bubble the error up (error initializing configuration system) so it'd be obvious why the tests were not run.
  • anIBMer
    anIBMer almost 10 years
    Thanks, for me, I put the appsettings on top of configurations by mistake, move it down to a proper position and it works.
  • evgenyl
    evgenyl almost 10 years
    in my case, it was result of invalid change in config file
  • Vinee
    Vinee over 9 years
    I added specflow through nuget and it inserted an entry into App.config. That created the whole trouble. I created a new App.config and added the reference again and it got fixed. Thanks for info.
  • cederlof
    cederlof over 8 years
    I don't have that option under Tools->Unit Testing->MsTest. (Resharper 9.2.)
  • Steven D.
    Steven D. over 8 years
    I can corroborate that nearly two years after this post was initially made, this still seems to be a viable fix (I'm using VS 2015 and ReSharper 9.2).
  • mortb
    mortb over 8 years
    I had (accidentally) reverted the changes to the project file when changing branch in Git. When I tried to run the test by right clicking in the class (code window was still open) it did not run as it was not part of the solution.
  • Chaquotay
    Chaquotay over 8 years
    The platform target mismatch can also happen with references to other projects inside the same solution.
  • Nemeas
    Nemeas over 8 years
    Did not work for me, I'm using VS2015 w/Reshaper 10.
  • atconway
    atconway over 8 years
    Yeah I had the identical issue. The idea might be to make the tests project and the target project identical for ease of access, but it screws with the test runner and produces this issue from the OP.
  • Kevin B Burns
    Kevin B Burns almost 8 years
    Weird, ReSharper just complained to me that my [Test] methods where private. Must be a new feature.
  • KiwiSunGoddess
    KiwiSunGoddess almost 8 years
    My issue was caused by a bad Git conflict resolution leaving Head change info in my resolved config file
  • Valentine Zakharenko
    Valentine Zakharenko over 7 years
    I changed culture of assembly and R# stopped run the tests.
  • datps
    datps over 7 years
    Bingo! Thanks Chris. In my case it was log4net section without a maching section name in <configSections>.
  • Tom
    Tom almost 7 years
    I had a Test assembly compiled against 3.6.1, and my main Test assembly was compiled against 3.7.1. Downgraded to 3.6.1 and now its all good.
  • realsonic
    realsonic over 6 years
    I also haven't such option in R# 2017.2.
  • kiprainey
    kiprainey over 6 years
    I had a similar issue when using test case directly rather than test case source. The end result is the same -- a mismatch between the number of arguments in the test signature and values in the TestCase attribute results in an inconclusive result.
  • Ben Power
    Ben Power over 6 years
    Yeah, I was missing <appSettings> from the <configuration> section... what did we do before StackOverflow!
  • Tasker
    Tasker over 6 years
    This got it for me working with VS2017 and Resharper Ultimate 2017.2.2 on a NETCore test project.
  • Sirar Salih
    Sirar Salih over 6 years
    Almost the same happened to me, I had added a connection string to a redundant appSettings section, when I removed the redundant appSettings section and moved the connection string to the original appSettings it worked.
  • MichaelMilom
    MichaelMilom about 6 years
    In my case, I had a silly typo in app.config <AppConfig> instead of <AppSettings>. I love ReSharper, but they REALLY need to work on their error messages!
  • atamata
    atamata about 6 years
    Same here, an entry in the config section has been commented out
  • Michael Freidgeim
    Michael Freidgeim about 6 years
    The answer about corrupted app.config is the same as first one stackoverflow.com/a/21386881/52277
  • Lars Holdgaard
    Lars Holdgaard about 6 years
    Worked for me. VS2017 with ReSharper 2017.1.3 :-)
  • Jony Feldman
    Jony Feldman about 6 years
    thank you! checking the output window reveled my problem, the class was not public!
  • ThomasG
    ThomasG almost 6 years
    Didn't help in my case
  • Marcel
    Marcel over 5 years
    For me, the option was unter Tools->Unit Testing->MsTest and unchecking helped.
  • andersh
    andersh over 5 years
    The <appSettings> node must not be placed above the <configSections> node
  • andersh
    andersh over 5 years
    The <appSettings> node must not be placed above the <configSections> node
  • Vladimir Melekh
    Vladimir Melekh over 5 years
    Dmitry, thank you, it helped me. Can you explain what is this service?
  • Dmitry Pavlov
    Dmitry Pavlov over 5 years
    @VladimirMelekh check this github.com/Microsoft/vstest/issues/472
  • PhoenixPan
    PhoenixPan about 5 years
    Worked for me and I don't have to clear build for the tests now. Thanks Elias.
  • Achilles P.
    Achilles P. about 5 years
    for me also, section name mismatch sendgrid.development vs sendgrid.test. Shady...
  • Puterdo Borato
    Puterdo Borato about 5 years
    It was the case for ReSharper 2017.3.2 and NUnit 3.11. See comment for nunit github.com/nunit/nunit/issues/3086#issuecomment-466988760
  • Ben Power
    Ben Power about 4 years
    This is one of those frustrating issues that gives you little clue as to the actual problem!
  • Kirsten
    Kirsten about 4 years
    Total mess up in app.config caused it for me
  • SharpC
    SharpC about 2 years
    "error" button in the top right corner of the window, useful! :-)