Resharper Unit Tests not running
- Samyn
- 2015-04-13 19:39
- 7
I'm trying to get started writing unit tests in a project. I wrote the createTest first and tried it. This test passed and I started writing my other tests.
Now all my tests just say "Test not run". This happens both when I try to run all tests at once and when I run a single test.
https://github.com/Requinard/OperationOctopus/tree/UnitTest
All I've found so far is people using NUnit. We're using the default microsoft testing framework, with resharper running the tests.
[TestMethod] public void CreateTest() { Init.Initialize(); // set up UserModel user = new UserModel(); user.Address = "Testing Street 1"; user.Email = "Testing@test.com"; user.Level = 2; user.Password = "test"; user.RfiDnumber = "00d0wad0aw"; user.Telephonenumber = "0638212327"; user.Username = "testcaseuser"; Assert.IsTrue(user.Create(), "Cannot write user to database"); test_user = user; } [TestMethod] public void ReadTest() { Init.Initialize(); // set up UserModel user = getTestUser(); Assert.AreEqual(user.Email, test_user.Email, "Reading returned an unexpected result"); } [TestMethod] public void AlterTest() { Init.Initialize(); UserModel user = getTestUser(); user.Email = "test@testing.com"; Assert.IsTrue(user.Update(), "Failure during updating"); user.Read(); Assert.AreNotEqual(user.Email, test_user.Email); } [TestMethod] public void DestroyTest() { Init.Initialize(); UserModel user = getTestUser(); Assert.IsTrue(user.Destroy(), "Could not destroy user"); }
The above tests will make resharper say "Test not run"
I just tried running the tests on my laptop. They worked without any changes to the code and the test completed instantly. This leads me to think I'm dealing with a faulty config somewhere.
7 Answers
Make sure you aren't doing what I was doing and completely forget that solution is in release mode with test project set to build only in debug mode ;-)
inconclusive: test not run, An attempt to execute such test-case using 'vstest' (which is how we run tests that target.netcoreappXX) will ultimately fail, because at the time of running, there won't be such test-case. Because of this and number of other issues with vstest runner, we are going to implement our own runner for projects targeting.netcoreappXX. An attempt to execute such test-case using 'vstest' (which is how we run tests that target.netcoreappXX) will ultimately fail, because at the time of running, there won't be such test-case. Because of this and number of other issues with vstest runner, we are going to implement our own runner for projects targeting.netcoreappXX.
Ted
2016-04-08 19:10
There was a bug in ReSharper 2017.3.1, which was fixed in 2017.3.2: https://blog.jetbrains.com/dotnet/2018/02/01/resharper-ultimate-2017-3-2-bugfix/
You can update using ReSharper
> Help
> Check for Updates
.
You can see if you had the same error by enabling logs. This is what I had:
--- EXCEPTION #2/2 [LoggerException] Message = "Passed version string '2.1.101' doesn't look to be a valid .net core sdk version"
And eventually:
|W| UnitTestLaunch | System.NullReferenceException: Object reference not set to an instance of an object. at JetBrains.ReSharper.UnitTestProvider.nUnit.v30.NUnitServiceProvider.GetRunStrategy(IUnitTestElement element) at JetBrains.ReSharper.UnitTestProvider.nUnit.v30.Elements.NUnitElementBase.GetRunStrategy(IHostProvider hostProvider) at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.BuildStage.CollectProjectsToBuild() at JetBrains.ReSharper.UnitTestFramework.Launch.Stages.BuildStage.Run(CancellationToken token) at JetBrains.ReSharper.UnitTestFramework.Launch.UnitTestLaunch.RunStage(Object stageObject)
My project is using NET471, and I run ReSharper 2017.3.1 in Visual Studio 15.6.27428.2005
resharper unit tests not showing, Not sure if this is a caching issue, but when i open my project which has about 350+ tests (mixed mstest and nunit), only about 50 or so appear in the unit test explorer. Then, as i open each test class file, the explorer updates and shows those tests in the treeview. Not sure if this is a caching issue, but when i open my project which has about 350+ tests (mixed mstest and nunit), only about 50 or so appear in the unit test explorer. Then, as i open each test class file, the explorer updates and shows those tests in the treeview.
Christian Rondeau
2018-03-19 17:31
This also happened to me, and found the reason in here: http://www.henrikbrinch.dk/Blog/2012/02/15/Making-Resharper-testrunner-work-in-64-bit
This fix is actually harsh, and what I did is change the configuration: VS2015 -> Resharper -> Options -> Unit Testing -> Default platform architecture - Force tests to run in 32-bit process
Hope this will help you
resharper xunit tests not showing, Ive created a sample project with 30 tests in the x86 project, and 20 tests in x64, on solution load the 30 tests appear in test explorer, but in x64 project only 10 of the 20 tests show until i open the test files. There is a mix of nunit and mstest, with different categories and some ignored others not. Ive created a sample project with 30 tests in the x86 project, and 20 tests in x64, on solution load the 30 tests appear in test explorer, but in x64 project only 10 of the 20 tests show until i open the test files. There is a mix of nunit and mstest, with different categories and some ignored others not.
daviddv
2015-10-07 08:34
Happened to me today and none of the above suggestions (clearing cache, restarting VS, suspend/resume of resharper) worked.
However in the Unit Test Sessions tab under Error I could see I had a TypeLoadException which allowed me to pinpoint the problem.
run test finished: 0 run, Run test finished: 0 run. Closed - Other Product visual studio 2017 version 15.9 windows 10.0. Manga Lavanuru reported Aug 28, 2019 at 01:37 PM. Tests are not executed in Test explorer as soon as ‘run test’ action starts and i see the out put as below: ------ Run test started ------. Run test finished: 0 run. Closed - Other Product visual studio 2017 version 15.9 windows 10.0. Manga Lavanuru reported Aug 28, 2019 at 01:37 PM. Tests are not executed in Test explorer as soon as ‘run test’ action starts and i see the out put as below: ------ Run test started ------.
Dr. ABT
2018-09-18 15:05
I periodically run into this because I work on a project with multiple branches and switch between them without shutting down Visual Studio. This will occasionally confuse ReSharper and I will no longer have the NUnit options on some projects.
In Visual Studio Community 2017 with ReSharper 2018.2 the first thing I try is to Unload the project where the NUnit test runner is not available. Sometimes that is the only needed step.
Next I use ReSharper->Options->General->'Clear caches' which requires a VS restart.
Then I unload and reload the misbehaving project again.
This fixes the issue.
resharper cannot parse testid, Updating VS, updating resharper, clearing cache automatically and manually and suspending resharper didn't help me. It's not a resharper issue, it is probably a VS bug. This worked for me. Thanks. – Milad Sep 10 '18 at 9:30 Updating VS, updating resharper, clearing cache automatically and manually and suspending resharper didn't help me. It's not a resharper issue, it is probably a VS bug. This worked for me. Thanks. – Milad Sep 10 '18 at 9:30
Naylor
2019-08-23 16:46
It seems there was a bad config /somewhere/. I reinstalled the entire sysetm, followed by VS2013 and R#. The tests now run fine.
resharper test-case objects missing for the following elements, Test-case objects missing for the following elements: Rebuild the project and try again. In the tooltip next to the unit test method it says: Inconclusive: Test not run and I think it said Unit test skipped at one point. Resharper shows a grey eye icon. There's also a wierd issue with visual studio's Test Explorer. Test-case objects missing for the following elements: Rebuild the project and try again. In the tooltip next to the unit test method it says: Inconclusive: Test not run and I think it said Unit test skipped at one point. Resharper shows a grey eye icon. There's also a wierd issue with visual studio's Test Explorer.
Samyn
2015-05-15 16:32
I think restarting the whole system may have been a little premature. I have found when this happens all you need to do is restart Resharper.
I usually do this from the Command Window in Visual Studio , you just need to type these commands one after the other
this generally fixes the problem for me and doesn't require reopening the solution.
If this fails you can clear the resharper caches. Information can be viewed here on how to do that.
here is how to do it from VS menu
unit tests not running in ReSharper unit test session explorer , I think restarting the whole system may have been a little premature. I have found when this happens all you need to do is restart Resharper. Hi, I'm developing a UWP app using VS Enterprise 2017 15.6.1 and ReSharper Ultimate 2017.3.3. I wrote some unit tests and have no
BastanteCaro
2018-11-02 14:54