VS2013 Resharper always runs all tests - visual-studio

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.

Related

How to run tests while debugging

I've been using ReSharper test runner in Visual Studio for quite a while, and there is one thing about it that I can't figure out.
I used to have some integrational tests in my solution that performed web requests to my local web server. I used to be able to launch my web application in debug mode, then launch a test with Resharper test runner within the same Visual Studio instance (that was currently running a debug session), and the test would run normally. The breakpoints in my application were hit, and I was able to debug the requests sent from the test.
However, when I was trying to do the same thing for a new project, the tests fail to launch. When I run any test, Visual Studio displays a modal window asking Do you want to stop debugging?. Why am I unable to run tests while having an active debugging session anymore? What does the ability to do this depend on? Visual Studio version? Resharper version? Unit testing framework (I'm currently using MSTest)?
I think I've seen this behavior before, it seemed to be driven by the fact that Resharper was feeling the need to always build my project/solution before running tests.
Try changing the Build Policy to Never (at first at least) from the Unit Test Sessions window:

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.

Test execution error in Visual Studio 2015 (worked in 2013)

We are in the process of upgrading from Visual Studio 2013 Update 5 to Visual Studio 2015 Update 1.
Our Solution has many tests and we use NUnit 2.6.4, along with the NUnit Test Adapter for NUnit 2.x.
When running these tests in Visual Studio 2013, they all run perfectly well.
However, when running in Visual Studio 2015 the first 200 odd tests run, then execution stops. I can then select the tests that have not yet run and successfully execute these. I have the latest ReSharper installed in both VS2013 and VS2015 and it happily executes all the tests.
We've been keeping test-coverage details for each release since the dawn of time, and from Visual Studio's test runner it shows me the number of blocks covered. But ReSharper shows us the number of statements covered. Slightly different values, but they'd mess up our charts.
When test execution fails, it creates a Dump file (it also creates some XML files that just seem to show what DLLs I've installed). I can open this and "debug" it, but it simply shows me a line of code that fails, and the call stack shows only [Managed Code], which means I can't identify the actual test that's causing the issue.
The fact that this works perfectly in VS2013 and in ReSharper running in VS2015 suggests that "it's not our fault", but whilst I'd like to think that, it doesn't help me fix this.
Any ideas?
Thanks
Griff
Tracked down the problem. We had one class in our Solution that implements IDispose and one of our Unit tests didn't dispose of that class, it just allowed it to go out of scope.
So because the Disposable object hadn't been disposed, the class' Finalizer hadn't been suppressed. The GC therefore called the Finalizer which in turn attempted to access another object that had also gone out of scope, resulting in an exception that crashed the Test Execution Runner.
Interesting that VS2015 running NUnit 2.x crashes, but the identical setup in VS2013 copes fine.
As an aside, when debugging the DUMP file (see above), I realized that the call stack was irrelevant, I just had to put in some defensive coding in the Finalizer.

Visual Studio Cannot Scan/Find MSTest Methods

I converted a project with nunit tests, so that it had mstests instead. It compiles, and when I right click on the project, I can select "run unit tests." It works, and the tests execute successfully.
However, I cannot see my tests in either the "Test List Editor" or the "Test View." I've tried:
selecting the "refresh" button in both those lists
rebuilding the solution
re-starting visual studio
Activated background discovery (I do have VS 2010 SP1, and resharper)
None of these, alone or in combination, has worked. What else can be tried, to force Visual Studio fully to recognize these tests?
The answer, I found, is that I must convert a class library to an MsTest project.
Also make sure that your test class is public, I spent almost one day trying to figure out why the MS test frame can't discover my test until I modified the access modifier from the default to public

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

Resources