Test explorer tree view in Visual Studio 2015 (à la SharpDevelop)? - visual-studio

I have just started using Visual Studio 2015 after having used SharpDevelop for several months. One of the things I miss the most is the tree view of the unit tests (Nunit in my case, with the TestAdapter working OK to show the tests in the test explorer). I am used to write the tests a in a separate assembly mirroring the folder and file structure of the project to test, so a tree view in the test explorer should be something natural, the same way a tree view is natural in the solution explorer.
In this way, I could run a single test, or the tests covering a single class, namespace, project or solution, everything from a single view, no need to be regrouping. But Visual Studio just groups the tests according to a few parameters, so I have to constantly change the grouping. Also, in SharpDevelop the tree nodes were preceded by a green/red dot that allowed you to easily find the failing tests.
So, is there any way to have a tree-view-ish window in Visual Studio 2015, showing the unit tests á la SharpDevelop?

I saw this in the ReSharper extension, which is paid.. VS'15' (still in beta https://blogs.msdn.microsoft.com/visualstudioalm/2016/08/05/evolving-the-visual-studio-test-platform-part-2/) appears to be almost there with namespace grouping, but still does not look like a full tree functionality. I am also interested in finding a free alternative.

In Visual Studio 2015 I use AxoCover for running Unit Tests. It provides a nice Tree View of the unit tests, grouping by project and namespace. It works with Visual Studio 2012 - 2017. I haven't heard of a 2019 version of AxoCover though. Hope it helps someone else stuck on old versions of Visual Studio.

Related

serviceHub.Host.CLR.x86 taking a lot of memory and CPC

serviceHub.Host.CLR.x86 taking a lot of memory and CPC in my Visual Studio 2017 solution.
This causes Visual Studio to crash.
Any ideas on what the underlying cause is?
The serviceHub.Host.CLR.x86 is responsible for running some processes in the background for Visual Studio 2017/2019.
Among other features, there are three Visual Studio features that run under this process and, in some cases, cause high CPU/Memory usage. They are:
Full solution analysis.
Live Unit Testing. (only in Visual Studio Enterprise)
Code Lens. (only in Visual Studio Enterprise and Professional)
Disable these features as follows:
Full solution analysis: from Tools\Options\Text Editor\C#\Advanced (please see the remarks section if your Visual Studio 19 version is 16.5 or later)
Live Unit Testing: from Test\Live Unit Test
If the Live Unit Test is running, select Stop.
Go to Tools\Options\Live Unit Testing and disable the option Start unit Testing on solution load.
Code Lens: from Tools\Options\Text Editor\All Languages\CodeLens
This feature has a lot of options. If you like Code Lens and want to keep using it, you can enable/disable each option to check which one is stressing your computer CPU/Memory.
That's it. I hope it helps.
Remarks:
In Visual Studio 2019 version 16.5, Microsoft removed the option to disable the full solution analysis.
However, you still have the option to narrow down the analysis scope to only one document. Select the option Current Document to restrict the analysis to the current document.
This process is also executed when installing Visual Studio with the option "Install and Download" at the same time.
If the computer is not so powerful, it will consume the rest of the CPU power till gets to 100%

An add-for visual studio 2013 that can trigger the run/debug of some google tests

I have a huge visual studio 2013 solution in c++, containing three types of projects : one console project that handles google tests, dll projects, and a static library project for the google test static libraries.
Often when I code and run the all the google tests, some tests happen to fail, and I have to debug them. To do this, I have to run the google test executable with a special option telling just to run the special test I want to debug etc...
After some time, it starts to be boring. That's why I have the following idea : I would like to have, when right-clicking in the middle of a test case, one more line at the end of the window appearing in visual studio 2013 (when I right-click) called for instance "debug this test" that would trigger the debug of this test.
I really didn't know the technology adequate to do this, but digging a bit brought me in the "visual studio 2013 add-ins" field, which is the right technology to achieve want I'd like to do. (To have when right-clicking in the middle of a test case in the c++ code, one more line at the end of the window appearing in visual studio 2013 (when I right-click) called for instance "debug this test" that would trigger the debug of this test.)
Is there any "examples" somewhere that I could inspire myself of ? Or could anyone guide me on the subject ?
Sorry I can't help VS2013 unfortunately. My professional career skipped that one.
However Visual Studio 2015 does give this functionality out of the box.
I'm sure there are some tools that can do this in VS2013, but I don't think its default?
https://msdn.microsoft.com/en-us/library/hh270865.aspx
EDIT. Apparently it is there is VS2013 and VS2012?

VS2013 Adding Types to Code Map forces Rebuilding Projects

We have a large solution (112 projects) in VS2013 Ultimate.
I love the Code Map feature, however when I am dragging types onto a Code Map dgml it insists on building the solution - even though I have not made any changes.
I can't see many options for this great feature, but is there anyway to tell it to stop building the solution everytime I add a type to the diagram?
This is a known issue and major complaint with Code Map in Visual Studio 2013. It affects certain types of projects (like ASP.NET ones) more than others because these projects always report that they have changes and need to be rebuilt.
The experience is improved in Visual Studio 2015 Enterprise, as we have added a "skip build" option.
We've made many improvements to CodeMap in Visual Studio 2015, so it's definitely worth getting it if you use Code Maps. Note that you can install VS 2015 along side VS 2013, so you don't have to migrate projects etc.
I see the code map document window in VS 2015 now contains a button labelled "Skip Build" which seems to solve this problem

Has anyone integrated NUnit with Visual Studio 2010?

Has anyone integrated NUnit with Visual Studio? I'm trying to set up a build pipeline like this one. But, I'm pretty new to .NET and I'm still understanding how things work. There are many resources in the internet on NUnit + VS, and I'm confused.
I'd recommend you to use Resharper.
As some say, "It just works".
Disadvantages/side effects of this choice in your case could be:
1. Resharper is not free;
2. Running unit-tests is minor part of Resharper - it also includes tons of other features, which you maybe do not need for now(but you can disable most of them in setttings).
Free solution is - Visual Nunit 2010 Visual studio extension. Free and does exactly what you want.
UPDATE
How to add NUnit to your project.
I've found this tutorial. Follow it step-by-step, I've found it helpful and complete for .NET novices.
The only difference is that in Running Unit-Tests section for running tests author uses test runner tool that is distributed within NUnit itself, but you can use ReSharper runner as described in JetBrains' docs
I'm using this:
http://visualstudiogallery.msdn.microsoft.com/c8164c71-0836-4471-80ce-633383031099
Which works quite well for me. You can access it within VS2010 from View->Other Windows->Visual NUnit
I used TestDriven until it was no longer free, I used Resharper but felt it slowed down my machine too much, I tried the VisualNUnit extension but it appeared to spawn multiple processes of itself that would keep a hold on some of my DLLs, I added NUnit itself as a command under Visual Studio Tools (and also with a toolbar button and some macros in Visual Studio to start the current test and attach) but that cost some effort to set up and didn't feel smooth enough after being spoiled with tools like TestDriven. Eventually I tried NCrunch... I am hooked ever since, and I have even started to favor it over TestDriven! the next tool on my "NUnit bucket list" will be the NUnit extension for Visual Studio 11.
PS: NCrunch should work on your Visual Studio 2010 and the homepage has a very decent demo video.
First download and install the NUnit
Step 1: Open Visual studio
Step 2: Open your project
Step 3: Select Properties from Solution Explorer
Step 4: Select Debug option in the properties window
step 5: select 'Start external program' under the section 'Start Action'
Step 6: Select the path of the NUnit file
Step 7: Save it.
After that when you debug your project NUnit will open.
Setting up Visual C#2010 Express with NUnit
The original and still quite ok test runner.
Test Driven .net
Used to be free, but now costs a small fee unless you're a student or open source developer.
Visual Studio 2011(BETA) is compatible with 2010 and provides test runners out of the box. Refer to Visual Studio 11 Beta Unit Testing – What’s New and Visual Studio 11 Beta - Unit Testing Plugins List. For continuous integration (CI) server U can use TeamCity and also run those test on the server.

Pex and F# in Visual Studio 2010 Ultimate

I have been trying using Pex in a F# project but I have faced several issues on which I would appreciate some help:
Visual Studio Pex addin worked for half an hour and not for complex project exploration.
After that each time I run a Pex Exploration from within Visual Studio 2010 I get a !warning! [metadata] no explorations found after applying all filters; did you forget a [PexClass] or [PexMethod] attribute? error message. If I copy and paste the command run by visual studio when doing the exploration and remove some attributes (like sourceFilter ...) and run it from a command console then I get some generated tests. Any idea why visual studio generates an invalid command?
After a while the Microsoft.Pex.Framework.dll either disappears from the .Net Reference list and I have to reference it manually using its file path or I can't even reference it any more and I have to uninstall/reinstall Pex. (A reference to C:\Program Files (x86)\Microsoft Moles\PublicAssemblie\Microsoft.Pex.Framework.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.)
All these issues don't occur when I work on a C# project.
Issues 1 2 3 occurred with the Academic version.
Using the version available for MSDN Subscriber I never got it working within visual studio (Visual Studio 2010 Ultimate NO SP1). However it worked from the command prompt. I did not face problem 3 with this version.
Has anyone managed to get Pex working with F# within visual studio ? If yes can you you tell me how you did it ? Which versions (VS and Pex) do you use ?
I have had some success running Pex with F#. The version I used, if I believe my Downloads folder, was the academic version of Microsoft Pex and Moles 0.94.51006.1 Release for (x86). The installation file was named pex.academic.x86.msi.
I don't know if that version predates yours.
My impressions from my trials were that Pex and F# were not a very good combination: Pex insisted on creating test cases with null inputs. As generating null values in F# isn't all that common, that's typically not the scenarios in which I'm interested. Adding lots of assumptions to eliminate those just left me with Pex not being able to generate test cases. Admittedly, the functions I was testing were too complex, I still like the idea behind Pex and might try it again on smaller/easier pieces of code.
Using Pex and its GUI inside VS 2010 worked relatively fine, but not without frustration.

Resources