VS2010 Unit test “Pending” and the test cannot be completed - visual-studio-2010

I'm using VS2010 (with windows 7).
Every time I try to run a unit test it stays on "Pending" and the test cannot be completed.
I tried to follow this msdn instructions.
I tried debugging test method (test view/debug selection), set breakpoints, but VS2010 indicates: the breakpoint will not currently be hit... I'm in debug configuration.
Any advice?

If you have VS2010 and VS2012 installed on the same box you need to install SP1 for VS2010 or the unit tests sometimes won't work. (SP1 available here.)

Try to do a clean solution (right click solution and clean). And then do a rebuild. That should solve the problem.

Related

VS 2015 Test Explorer is empty

I'm on update 3 with VS2015 and suddenly Test Explorer (for MSTest) doesn't show anything, it's just empty.
I don't have any extensions installed that relate to unit testing, no NUnit stuff, no Resharper etc. Obviously, solution has been compiled. The same for all solutions with unit tests, they all used to show tests in test explorer but suddenly they all are empty.
What does not work:
Rebooting
Restarting VS 2015
Devenv.exe /ResetSettings
Running a test (by right-clicking on test code)
Setting Processor Architecture to X64 in Test Settings
Starting VS in admin mode
Deleting contents of %LocalAppData%\Micr‌​osoft\VisualStudio\12‌.0\ComponentModelCach‌​e
Anyone have a fix?
pom
Please see issue and fix here: https://connect.microsoft.com/VisualStudio/Feedback/Details/2970831. Let us know if this fixed it in your case.

How to figure out why ReSharper is not rebuilding unit test project before running?

Recently I am having an annoying problem. When I go to Unit Test Sessions window and run some tests, ReSharper seems to completely ignore any changes in my code(even in the code of the test itself!) and does not rebuild anything. Because of that I have to rebuild everything manually. I think that problem is too generic to post on bug-tracker so I would like to find at least any additional information. For MsBuild I can always enable diagnostic logging and track all its decisions during build. How can I find what is the problem with ReSharper?
Versions:
Visual Studio 2015 Pro Update 2; ReSharper Ultimate 2016.1.2.
Have you installed the Rider EAP by any chance? There is a bug in the latest EAP (EAP7) that sets the build action before running tests to "Never", and since the global settings file is shared between Rider and ReSharper, this also causes ReSharper to not build tests before running. The fix is simple - just change the value in the drop down in the unit test runner window. See the bug report for more details.
One thing I'm not sure on is if this is a recurring issue - i.e. the value gets reset to "Never" every time Rider opens the unit testing window. This is an unfortunate bug, and will definitely be fixed for EAP8.

VS2013 Resharper always runs all tests

I got this strange problem with VS2013, NUnit and resharper
When I try to run a single test it always runs all tests in the project. It doesn't matter if I select Run or Debug or if I start it from the editor, unit test explorer or unit test session.
Only the test I started show up in the Unit Test session. No results from the other tests is visible but break points are hit in all tests.
The problem seem to start at random after editing a test. Have tried clean rebuilds and restarting Visual Studio but the problem remain.
Restarting the computer helps but only until it starts again after some edit.
Using VS2013 update 5, Resharper 10.01 and Nunit 3.0.1 (also tried 2.6.4)
Is this a Visual Studio, NUnit or Resharper problem?
Only other strange thing I noticed is that CTRL-Q (R# show documentation) does not work within test methods. It always show documentation for the test method not the variable or class the cursor is on.

Resharper 6 simply ignores all my tests

I have a solution with a lot of nunit tests in different projects. When I run resharpers testrunner, it finds all the tests. But when it comes to execution it simply marks them all as grey and silently completes.
How do I figure out whats wrong with the testrunner, and most importantly how do I get it to run my tests.
I have resharper 6 in visual studio 2008. My code is on a fileshare, and everything runs in a virtual machine.
Jetbrains has confirmed this to be a bug. That resharper wont run nunit tests located on a networkshare. They'll try to fix it in 6.1.
You can find the ticket here:
http://youtrack.jetbrains.net/issue/RSRP-275538

How does MbUnit work with VS 2008

I set up MbUnit and have been trying to get it to work with VS 2008 using the MbUnit GUI but every time I run a test it closes and I get a this program needs to close error.
I had a similar problem with Gallio where I got a runner exception every time I ran a test.
Do I need an addin for VS like testDriven.Net to get this to work?
Same here. TestDriven.Net really makes things slick and easy. Right-click on a test and run it... MBUnit integrates fine with that add-in.
You don't need TestDriven.Net but it sure helps.
When you say you use the MBUnit GUI "but every time I run a test it closes..." do you mean that MBUnit closes or VS2008? If is MBUnit, then perhaps there is something wrong with your installation. If it is VS2008, then something is fishy since MBunit shouldn't cause VS2008 to crash.
I've used (though I've stopped and now use NUnit) MBUnit with TestDriven.Net and VS2005 with great success.
I'd recommend testdriven.net for a free tool, and ReSharper as a better tool for running MbUnit tests.
The Gallio test running shouldn't be crashing on you like that, there is a problem somewhere.
I'm using combination of Visual Studio 2008, ReSharper 4.1 and latest builds of Gallio. With that it works pretty well.

Resources