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

59

195

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.

Ivanivana answered 19/8, 2013 at 10:3 Comment(8)
It's a known issue in ReSharper. There are some potential solutions here: #12191852.Linin
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.Rockbottom
@ChrisMantle I checked it out and changed my default processor architecture, but it still doesn't workIvanivana
@MarkWalsh I'm using VS2012. I still cleaned and rebuilt the solution as you said, but still doesn't workIvanivana
Have you tried restarting the OS (Last shot)Rockbottom
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 inconclusiveIvanivana
Since ReSharper is giving me a hard time. I decided to quickly test it with NUnit3 Test Adapter visualstudiogallery.msdn.microsoft.com/…Tyrrell
this question is discussed at metaHackery
I
24

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

Ivanivana answered 21/8, 2013 at 11:46 Comment(3)
I don't have that option under Tools->Unit Testing->MsTest. (Resharper 9.2.)Exterminate
I also haven't such option in R# 2017.2.Bummalo
For me, the option was unter Tools->Unit Testing->MsTest and unchecking helped.Extine
C
142

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.

Crypto answered 27/1, 2014 at 16:59 Comment(9)
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.Mirador
Thanks, for me, I put the appsettings on top of configurations by mistake, move it down to a proper position and it works.Poky
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.Architrave
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).Amerigo
Bingo! Thanks Chris. In my case it was log4net section without a maching section name in <configSections>.Pros
Yeah, I was missing <appSettings> from the <configuration> section... what did we do before StackOverflow!Cryptoclastic
Same here, an entry in the config section has been commented outInvestigate
The <appSettings> node must not be placed above the <configSections> nodeAcerbity
for me also, section name mismatch sendgrid.development vs sendgrid.test. Shady...Rafaelof
S
61

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 :)

Shanan answered 15/3, 2016 at 15:59 Comment(0)
S
37

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"

Sheeran answered 27/11, 2013 at 14:32 Comment(4)
This sorted it for me, after looking at a load of other fixes. I'm using VS 2013 and R# v8.1Feuar
Did not work for me, I'm using VS2015 w/Reshaper 10.Phenomenal
This got it for me working with VS2017 and Resharper Ultimate 2017.2.2 on a NETCore test project.Sailer
Worked for me and I don't have to clear build for the tests now. Thanks Elias.Workingman
I
24

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

Ivanivana answered 21/8, 2013 at 11:46 Comment(3)
I don't have that option under Tools->Unit Testing->MsTest. (Resharper 9.2.)Exterminate
I also haven't such option in R# 2017.2.Bummalo
For me, the option was unter Tools->Unit Testing->MsTest and unchecking helped.Extine
F
21

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.

Flamenco answered 18/8, 2018 at 23:33 Comment(2)
"error" button in the top right corner of the window, useful! :-)Delibes
The "error" button top right corner helped... it was a file not found (the runntimeconfig.json) and..... figured out the full path was too long, I had to rename my project name and now it works...Pneumonic
L
15

For me, simply cleaning and rebuilding the solution fixed it.

Lissome answered 19/12, 2013 at 22:50 Comment(1)
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.Binocular
E
15

I was having this problem, and it turned out to be the same as this problem over here. This answer solved the problem for me.

  1. Uncheck "Only build startup projects and dependencies on Run" (Options -> Projects and Solutions -> Build and Run)
  2. In Configuration Manager, make sure both the start-up project and the Test project have "Build" checked.

The second time I hit this issue, it was due to an ampersand in the filepath to the project where the tests reside. It works fine with ReSharper's test runner, but not dotCover's. Remove the ampersand from the filepath.

This is a confirmed bug with dotCover.

Erwinery answered 5/4, 2015 at 15:29 Comment(1)
Worked for me. VS2017 with ReSharper 2017.1.3 :-)Mcgriff
M
13

For me, the problem was a corrupt NUnit/ReSharper settings XML-file (due to an unexpected power shortage).

To identify the error I started Visual Studio with this command:

devenv.exe /ReSharper.LogFile C:\temp\resharper.log /ReSharper.LogLevel Verbose

Examining the file revealed the following exception:

09:45:31.894 |W| UnitTestLaunch                | System.ApplicationException: Error loading settings file
System.ApplicationException: Error loading settings file ---> System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.Load(String filename)
   at NUnit.Engine.Internal.SettingsStore.LoadSettings()
   --- End of inner exception stack trace ---
   at NUnit.Engine.Internal.SettingsStore.LoadSettings()
   at NUnit.Engine.Services.SettingsService.StartService()
   at NUnit.Engine.Services.ServiceManager.StartServices()
   at NUnit.Engine.TestEngine.Initialize()
   at NUnit.Engine.TestEngine.GetRunner(TestPackage package)
   at JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.<>c__DisplayClass1.<RunTests>b__0()
   at JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.WithExtensiveErrorHandling(IRemoteTaskServer server, Action action)

Note that this is NOT the test project's app.config!

A quick googling around identified the following file as the culprit:

%LOCALAPPDATA%\NUnit\Nunit30Settings.xml

It existed, but was empty. Deleting it and restarting Visual Studio solved the problem.

(Using Visual Studio Professional 2017 v15.3.5 and ReSharper 2017.2.1).

Mizuki answered 28/9, 2017 at 8:1 Comment(0)
I
8

I just fixed this issue as well. However, none of the solutions in this thread worked. Here's what I did:

Since R# wasn't giving any detail about why things were failing, I decided to try the built-in VS2013 test runner. It experienced the exact same behavior where none of the tests ran. However, looking in the Output window, I finally had an error message:

enter image description here

An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object.

This led me to another thread on SO with a solution. Believe me, I would have NEVER guessed what the issue was.

I had recently made a few changes to the AssemblyInfo.cs file while creating a NuGet package. One of the changes including specifying an assembly culture value of "en".

I changed this:

[assembly: AssemblyCulture("")] 

to this:

[assembly: AssemblyCulture("en")]`. 

That was it! That's what inexplicably broke my unit tests. I still don't understand why, however. But at least things are working again. After I reverted this change (i.e. set the culture back to ""), my tests began running again.

Hope that helps somebody out there.

Icon answered 18/3, 2014 at 15:9 Comment(2)
I changed culture of assembly and R# stopped run the tests.Engels
thank you! checking the output window reveled my problem, the class was not public!Krever
S
8

My problem was that I had only installed NUnit with nuget. I hadn't installed NUnit3TestAdapter which was also required.

Install-Package NUnit3TestAdapter
Swatch answered 2/5, 2018 at 15:43 Comment(1)
This is one of those frustrating issues that gives you little clue as to the actual problem!Cryptoclastic
L
7

In my case i got this error because of 'Release' mode where build of UnitTests project was simply switched off. Switching back to 'Debug' mode fixed it.

It's really surprising that ReSharper cannot say anything in case it cannot find UnitTests library at all. Seriously, it's a shame;)

Hope it will help somebody

Lavone answered 21/7, 2015 at 20:11 Comment(0)
M
7

In my case [Test] methods were just private. S-h-a-m-e

Microphysics answered 28/1, 2016 at 22:36 Comment(1)
Weird, ReSharper just complained to me that my [Test] methods where private. Must be a new feature.Ukase
D
7

This error occurred with Visual Studio 2017 and resharper version 2018.2.3 but the fix applies to Visual Studio 2019 versions to.

The fix, to get tests working in Resharper, was simply to update to the latest version of Resharper (2019.2.1) at the time of writing.

Demote answered 29/8, 2019 at 14:30 Comment(0)
D
6

In my case it was a mistake i did while copying the connectionstring in the app.config.. I had put it inside the configSections tag!

Took me a while to realize that... thanks VS intellisense though.. or was it resharper?

Daisy answered 12/4, 2014 at 13:45 Comment(4)
in my case, it was result of invalid change in config fileClass
My issue was caused by a bad Git conflict resolution leaving Head change info in my resolved config filePout
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.Isotope
The answer about corrupted app.config is the same as first one https://mcmap.net/q/128012/-test-method-is-inconclusive-test-wasn-39-t-run-errorDismuke
L
5

I had similiar issue. VS 2010, c# CLR 2 Nunit 2.5.7 , just build > clean solution from VS helped to resolve this issue

Lustre answered 4/2, 2014 at 21:53 Comment(0)
J
5

In my case I created an async test method which returned void. Returning of Task instead of void solved the issue.

Jacynth answered 10/11, 2015 at 20:52 Comment(0)
J
5

In my case, all tests within some test projects within a solution started not running after I added new projects. Using VS 2017 with ReSharper 2017.1.2 here.

First of all, make sure you're not wasting time assuming that your issue is ReSharper related. It is easy to assume that there's something wrong with ReSharper if you use its unit testing features including Unit Test Explorer. Open up Visual Studio's Test Explorer under the Test menu and try Run All". The added advantage of doing this is that the output window will show an error message that might point you in the right direction. If you notice that the same set of test are not run, then it is safe to assume that the issue is with Visual Studio and not ReSharper.

I ended up deleting and re-adding one of the Active solution platform, Any CPU, in Configuration Manager. By doing so, after saving my changes and reopening the solution, all tests started running again.

I believe there was an unexpected configuration entry in the solution file when I added new projects and by using recreating one of the platforms, it corrected itself. I tried diffing but it was difficult to tell what had changed to cause the issue.

Jungle answered 2/6, 2017 at 19:6 Comment(1)
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!Commissure
C
5

I'm was having the same problem to run any test using NUnit framework. "Inconclusive: Test not run" Visual Studio 2017 15.5.6

ReSharper Ultimate 2017.3.3 Build 111.0.20180302.65130

SOLVED Adding project dependency to Microsoft.NET.Test.Sdk

Caesium answered 12/3, 2018 at 11:49 Comment(2)
Didn't help in my caseRation
every test project need this dependency - even if the related project already have itDeformation
D
4

Have you added any DLL dependency recently? ... like me

I just ran into the same issue and it was very exasperating not to get any clue in the test output window or elsewhere practical.

The cause was extremely stupid: I just added the day before dependency to an additional external DLL in a sub-project, and the main project App indeed built and ran correctly after the change. But my unit tests are in a sister project to the main app, and thus had too the dependency on this changed sub project where the DLL was invoked... yet, the runtime location of the test project is not that of the main App! So changing the build to do copying of the missing DLL into the test runtime directory fixed the problem.

Diagenesis answered 15/9, 2014 at 8:30 Comment(0)
D
4

I am using VS2013, ReSharper 9.1 with MSpec extension from ReSharper and Moq. I experienced the same "inconclusive" error.

It turned out the one of my Mock's from Moq was not initialized, only declared. Ones initialized all tests ran again.

Dispend answered 6/5, 2015 at 9:54 Comment(0)
B
4

In my case my test method was private I changed it to public and it worked.

Barrator answered 21/4, 2016 at 14:56 Comment(0)
M
4

For those who are experiencing this issue for my test project .NET Core 2.0 in the Visual Studio 2017 Community (v15.3 3). I also had this bug using JetBrains ReSharper Ultimate 2017.2 Build 109.0.20170824.131346 - there is a bug I posted.

JetBrains advised to create a new test project from scratch to reproduce it. When I did that and got tests working OK, I found the reason causing the issue:

  • Remove this from your *.csproj file:
  • Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}"

When I did that - tests started working fine.

Methadone answered 7/9, 2017 at 15:45 Comment(2)
Dmitry, thank you, it helped me. Can you explain what is this service?Jiggle
@VladimirMelekh check this github.com/Microsoft/vstest/issues/472Methadone
M
4

For who are in rush for test execution, I had to use VS 2017 test explorer to run tests;

enter image description here

enter image description here

Masquer answered 16/2, 2018 at 20:38 Comment(0)
M
3

I'm using VS2010, NUnit 2.6.3 (although internally ReSharper says it's using 2.6.2?), ReSharper 7.7.1 & NCrunch 2.5.0.12 and was running into the same "...test is inconclusive..." thing with NUnit, but NCrunch said everything was fine. For most of today NUnit & NCrunch were in sync agreeing about which tests were happy and which needed refactoring, then something happened which I still don't understand, and for a while NCrunch said I had failing tests (but stepping through them showed them to pass), then decided they were all working, and NUnit started complaining about all my tests except one with the same message "..test is inconclusive..." which I was again able to single step through to a pass even though NUnit continued to show it as "inconclusive").

I tried several of the suggestions above to no avail, and finally just closed VS2010 & reopened the solution. Voila, now all my tests are happy again, and NCrunch & NUnit are reporting the same results again. Unfortunately I have no idea what changed to cause them to go out of sync, but closing & reopening VS2010 seems to have fixed it.

Maybe someone else will run into this and be able to use this simple (if ultimately unsatisfying since you don't know what the real fix is) solution.

Measurable answered 24/3, 2014 at 22:5 Comment(0)
L
3

I had this same issue. The culprit was an external reference not being compatible with my project build settings. To resolve, I right clicked on the project->properties->build->Platform Target-> change from Any CPU to x86.

The particular *.dll that I was working with was System.Data.SQLite. That particular *.dll is hardcoded for 32 bit operation. The "Any CPU" setting attempted to load it as 64 bit.

Livestock answered 5/6, 2015 at 16:31 Comment(1)
The platform target mismatch can also happen with references to other projects inside the same solution.Pump
M
3

My solution:

NUnit 3.2.0 has some issues with Resharper - downgrade to 2.6.4:

update-package nunit -version 2.6.4
Maki answered 6/4, 2016 at 4:41 Comment(0)
P
3

Caused by missing (not corrupt) App.Config file. Adding new (Add -> New Item... -> Application Configuration File) fixed it.

Pothole answered 1/7, 2016 at 13:43 Comment(0)
T
3

I had the same problem.It was related to compatibility version between NUnit 3.5 and Resharper 9.2,since it was solved by downgrading from NUnit 3.5 to 2.6.4. It worked for me. good luck.

Toluol answered 26/12, 2016 at 8:2 Comment(2)
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.Bardwell
It was the case for ReSharper 2017.3.2 and NUnit 3.11. See comment for nunit github.com/nunit/nunit/issues/3086#issuecomment-466988760Yordan
C
3

If you are using xUnit, I solved the issue installing xunit.running.visualstudio package. (currently using xUnit 2.3.1 and VS17 Enterprise 15.3.5)

Chlorobenzene answered 9/11, 2017 at 9:36 Comment(0)
E
2

I had the exact same problem, no tests were run in my test-project. As it happend I had the wrong configuration selected when running the tests. Changing it back to Debug fixed the problems.

Debug configuration

Exterminate answered 24/8, 2015 at 8:35 Comment(0)
C
2

For those still not able to solve their issue, check the Consolidate tab when managing your Nuget packages.

Turned out our unit test project referenced a different version causing this completely vague error.

Cyaneous answered 8/7, 2020 at 19:6 Comment(0)
B
1

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!

Brittne answered 3/8, 2014 at 9:5 Comment(1)
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.Orvilleorwell
K
1

For me, one test created this error and it turned out I had unintentionally skipped the test. On the left of the screen, where you click to put a break point, you may notice that your test is set to be skipped (there's a microsoft icon to indicate this). I enabled the test and the error went away.

Kania answered 29/9, 2014 at 19:58 Comment(0)
B
1

Very strange behavior.

Just moved a new appsetting entry recently added to the bottom of the app.config solved my issue.

<appSettings>
    <add key="xxxxxx" value="xxxxx" />
</appSettings>

Hope this helps someone

Bautista answered 1/12, 2014 at 16:50 Comment(2)
The <appSettings> node must not be placed above the <configSections> nodeAcerbity
Total mess up in app.config caused it for meAmericanist
S
1

In my case, I referenced 2 projects from my unittestproject. Both referenced projects used a dll with the same name, but with a different version.

I did not notice this in Visual Studio. I noticed the error in the Eventviewer.

To solve this, I used bindingRedirect in the app.config of the unittestproject to fix the dll-version.

Sleigh answered 22/3, 2016 at 14:34 Comment(1)
Same here, after upgrading some other packages, the nuget package manager added some binding redirect to other nUnit version than it should be. Removing the binding redirect from the app.config solved the issue.Markettamarkey
H
1

In my case found that the TestCaseSource has different number of argument than the parameter in test method.

[Test, TestCaseSource("DivideCases")]
public void DivideTest(int n, int d, int q)
{
    Assert.AreEqual( q, n / d );
}

static object[] DivideCases =
{
    new object[] { 12, 3 },
    new object[] { 12, 2 },
    new object[] { 12, 4 } 
};

Here each object array in DivideCases has two item which should be 3 as DivideTest method has 3 parameter.

Horwath answered 3/11, 2016 at 11:2 Comment(1)
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.Rensselaerite
M
1

All the test for my class became inconclusive after some code changes (they were passing previously).

It appeared that I had added a new field to my testing class:

private readonly Foo _foo = CreateFoo();

The problem was that an exception was thrown inside 'CreateFoo()', so it happened for all the tests and instead of failing they all became inconclusive.

Malaco answered 1/3, 2017 at 0:33 Comment(0)
B
1

In my case, ReSharper gave me this additional exception in the test window:

2017.06.15 12:56:57.621   ERROR Exploration failed with the exception:
System.AggregateException: One or more errors occurred. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.DiscoveryStage.Run(CancellationToken token)
---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---

it ended up that the test projects giving this error both were not set to build at all in the Configuration Manager. Checking the checkbox to build the 2 test projects and rebuilding sorted for me.

enter image description here

Boyar answered 15/6, 2017 at 12:6 Comment(0)
K
1

I know this question has /several/ answers to it, but I have yet another unique answer that I haven't seen as a way to resolve it. I'm hoping this helps someone else out there.

To use the Unit Test Sessions, one external dependency is the Microsoft.Net.Test.Sdk, at some point in the VS pipeline the xunit.runner.visualstudio stopped working correctly for the ReSharper Unit Test Session flavor of test runner. The following is how I ended up with this problem, and how I solved it.

My issue and answer arose from seeing the Inconclusive when converting some of my net451 libraries into netStandard 2.0 in order to allow my team to develop in Core or Framework. When I went into the newly finished netStandard2.0 libraries and started converting their old unit test projects into the new solutions, I ran into issues. You can't run Unit Tests in a net Standard project, so I chose to downshift to net472 for my unit testing projects.

At this point I'll note, .csproj files have gone through a change since .net Framework. In order to cleanly integrate with build packs for nupkg files and .net Standard libraries, you need to change your references to be handled with PackageReference instead of packages.config.

I had a few libraries coupled to Windows that couldn't be converted to netStandard, so when updating their dependencies to use the new netStandard libs, I realized that the dotnet pack command would fail if their .csproj files were in the old format. To fix that, not only did they need to be converted to PackageReference from packages.config, I had to manually update the .csproj files to the newer VS2017 format. This allowed those libraries to build into nuget packages cleanly as net472 libraries referencing netStandard2.0 dependencies.

There is a tool to convert the package organization behavior for you, it keeps the old .csproj style and uses the PackageReference in the .csproj. And due to the above I got in the habit of migrating the .csproj style to the VS2017 format manually.

So in summary, I was receiving the Inconclusive when I was using both PackageReference for my dependencies AND my Unit Testing Project .csproj file was in the VS2017 style.

I was able to solve this by deleting my project, recreating it exactly as it was in net472 and instead of converting it to the VS2017 .csproj format, I left it in the old format.

The old format, for whatever reason, allows my Test Session to complete.

I'm curious of few things:

  1. If a lot of the people with this issue were experiencing it in netCore versions where the .csproj files come in the new format by default.
  2. If people able to solve the issue by other means than my reproduceable problem/fix were on the netCore versions of .csproj and using netCore as their test project as well.
  3. If this solution will help any of the people that weren't able to fix it through rebuilds or deletion of vs/bin folders or additional entries in their .csproj files.

I don't know that this answer is the one true solution that ReSharper would need to fix it for everyone, but it is reproduceable for me, and solves my problem to leave the unit test project as the old version of .csproj file, at least when I have a net472 unit test project referencing netStandard2.0 libraries.

It should also be noted that VS2017 .csproj files deprecates the need for an AssemblyInfo.cs file in the Properties folder, which I'm not sure if that causes issues for the Unit Test Sessions as well.

Kestrel answered 27/10, 2020 at 17:19 Comment(0)
R
1

I had a version mismatch in my nuget dependencies between projects in a solution. Using the consolidate feature in Visual Studio helped identify and fix this.

Rabassa answered 14/1, 2021 at 15:15 Comment(0)
B
0

I had the same error in VS2013 and Resharper9. The problem was because i forgot to annotate test method with [Test] :) Hope this helps anyone

Bow answered 3/4, 2015 at 13:47 Comment(0)
G
0

This problem started when I upgraded to .NET Core 1.1.0

Solved by adding the following dependency to the project.json of the test project:

"Microsoft.DotNet.InternalAbstractions": "1.0.500-preview2-1-003177"
Ganoid answered 31/1, 2017 at 1:7 Comment(0)
H
0

In my case it was due to passing in \r\n characters inside TestCase's. Not sure why it's causing intermittent issues, as it works most of the time. But if I remove \r\n the test is never inconclusive:

[TestCase("test\r\n1,2\r\n3,4", 1, 2)]
public void My_Test(string message, double latitude, double longitude)
Hume answered 8/5, 2017 at 17:40 Comment(0)
C
0

In my case (Visual Studio Community 2017 version 15.2) the source of issue was new way of loading projects introduced in VS 2017, i.e. 'Lightweight Solution Load'.

In "Unit Test Sessions" window I noticed that solution has way less tests then it should. I had to open each unit test project manually in "Solution Explorer" and only then all tests were loaded and passed.

One way to solve this is to disable "Lightweight Solution Load" by right clicking on solution in "Solution Explorer" and set "Disable Lightweight Solution Load".

Circumscription answered 5/7, 2017 at 16:59 Comment(0)
F
0

enter image description here

enter image description here

Sometimes Just try drop header(.h) file and reAdd it as source(.cpp) NOT rename. Test in resharp c++ && vs2019 ,Test Code is Here

Fourgon answered 17/7, 2019 at 13:5 Comment(0)
L
0

For me the issue was an asynchronous call which was not waited in any way.

   dc.Start(); // Asynchronous, it is mocked on this particular test, so i did not bother blocking the test.

Changed it to :

   dc.Start().ContinueWith(t =>
   {
        waitHandle.Set();
   });

   waitHandle.WaitOne(60000); // wait dc start

And the test began to be applicable again.

Leboff answered 6/11, 2019 at 9:10 Comment(0)
S
0

In my case I had an error in my application configuration file app.config. I had misplaced appsettings above the configSections instead of placing it inside. So a corrupt configuration file could be the cause of Resharper not running your tests responding Inconclusive.

Samathasamau answered 5/2, 2020 at 8:50 Comment(0)
S
0

I had all tests from a single test class failing with this issue, all other were running well. Later I found an error in a [ignore] attribute in one the tests on this class.

Saguaro answered 26/6, 2020 at 14:34 Comment(0)
P
0

Another one method of solving this problem:

Run tests in another environment (TeamCity for example) and see your REAL problem. My problem was incorrect binding redirect to System.Web.Mvc 5.2.6.0 (not installed on my machine).

Pantoja answered 17/7, 2020 at 8:46 Comment(0)
H
0

My issue has been solved by the most superficial solution:

Add the Moq nuget package to the test project solve the inconclusive test method, and you can remove the nuget package afterwards.

After adding the Moq package my test method runs with the following nuget packages: Castle.Core (4.4.0), Moq (4.13.1), NUnit (3.12.0), System.Runtime.CompilerServices.Unsafe (4.5.0) and System.Threading.Tasks.Extensions (4.5.1)

After removing most of the above nuget packages my test method still runs with only NUnit (3.12.0).

Appreciate if someone figures out why this happens.

Hysterectomize answered 20/7, 2020 at 16:4 Comment(0)
O
0

Hope it'll help other, my fix was to update packages, there was a consolidation, and making all work with same packs fixed this issue for me. GL!

Obel answered 10/12, 2020 at 11:5 Comment(0)
I
0

Gaaaa.

First a debugging tip.

I ran

dotnet test

from command line.

That told me:

MyTests does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

When I went and looked.

[TestMethod]
private void MyFirstTest() 
{
}

Gaaaa.

I had it private vs public.

My fix:

[TestMethod]
public void MyFirstTest() 
{
}

Lesson learned. Check the BASICs. but the "dotnet test" told me about the basics.

Ineffectual answered 25/10, 2021 at 20:25 Comment(0)
A
0

In my case, it was just .NET 5 runtime missing. After installing one, the problem is gone.

Aeroneurosis answered 3/12, 2021 at 17:56 Comment(0)
C
0

In my case I was using Rider and MSTest and resolved the issue by going to

Tests > Unit Testing Settings

and changing Default platform architecture from Automatic to x86

Comprador answered 28/7, 2022 at 9:27 Comment(0)
M
0

I had to install following packages for Xunit:

enter image description here

Masquer answered 30/12, 2022 at 18:16 Comment(0)
R
0

In case you have already installed the following nuget packages:

  • Microsoft.NET.Test.Sdk
  • MSTest.TestAdapter
  • MSTest.TestFramework

and still cannot run the tests, make sure that the .NET runtime the project is targeting is installed in your computer.

I had a fresh installation of VS2022 and all .NET Core runtimes were not installed. The test project was targeting .NET Core 2.1. Once I installed the SDK the tests could be discovered. However, it is recommended to update your projects to a long term support framework if possible.

Richmound answered 23/3, 2023 at 9:37 Comment(0)
F
0

For me it was a ReSharper problem, too. But non of the suggested solutions worked for me so I just updated ReSharper to the latest version and the tests functioned again.

Fluky answered 10/11, 2023 at 17:4 Comment(0)
M
0

In my case, I had two empty methods, which have the [ClassInitialize] and [ClassCleanup] attributes and the same names. I commented them out and solved the problem. Temporarily...

Mcmullan answered 1/4, 2024 at 21:17 Comment(0)
S
-1

I used the ReSharper Build to fix this.

ReSharper => Options => Tools => Build => General => Use ReSharper Build
Stenographer answered 5/1, 2018 at 7:38 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.