I have looked at this question; Why don't I get code coverage results for C++/CLI project in Visual Studio 2010? and the F1 page, but that doesn't help me much. I have set the profiling on and rebuilt, but I can't find the 'Data and Diagnostics' page, or see anything which resembles a coverage data file in the project folder.
What I am trying to do get an equivalent to 'gcov' on a Linux platform, get a chart of how much code is being missed by the test suite.
I'm using Visual Studio 2005 Professional Edition and UnitTest++ as the test framework. Any help would be most welcome.
For VS 2005 (or 2008, for that matter) you can use the free nCover 1.5.8 version to get line coverage information.
Apart from that, real coverage tools for .net seem to be premium content (where they haven't been abandoned entirely like Clover.net); only do line coverage using the profiling APIs for pre-.net 4 (nCover free, PartCover); or rely on rewriting the IL with what are in effect trace statements one per code-point.
Related
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%
I'm currently investigating my options to run automated tests from within Visual Studio 2008 Professional. I noticed that the MSDN page documenting the integrated funcionality is only available for VS 2008 and VS 2005. This kind of makes me suspcious. Since we are planning to upgrade to VS 2010 I'm wondering whether I will able to continue to use my configurations and knowledge with VS 2010? Does anyone here have made any experience with this?
TIA, Thomas
No need to be nervous, the terminology around the test configuration has merely changed in VS 2010. Most of what you know is the same but resides under different product branding which causes some versioning problems in the documentation.
Most notably, "test configuration" is often referred to as "test settings" under 2010.
Microsoft moved away from silo-ed "Team Test" terminology of VS 2005/2008 to a more holistic big picture known as Microsoft Application Lifetime Management, where testing is an integrated component for delivery of successful applications. Keep in mind that most of the documentation you'll find for testing refers to the Test Manager, which ship with the Ultimate and Test editions of Visual Studio. The Test Manager ties Tests to Use Cases and Requirements and is part of that big picture.
If you're not going down the ALM big picture, the focused view of just running tests hasn't changed much at all, with the exception of some new features like Test Impact which are pretty cool.
The following links may be useful to you, as it sounds like you're interested in how the tests can be used by developers or part of your build process:
Running Automated Tests within Visual Studio
Running Automated Tests from the Command-line
Hope that helps!
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.
In my team we shall use Visual Studio 2010 and .NET 4.0 as soon as possible and I have a question regarding VS 2010 and Team City.
In VS2010 there is a simple tool to measure mstest coverage. Question: Is it possible to read the result of ms-Coverage from team city?
If yes, how do we set up that configuration.
best Regard
Henrik
Yes, you can use the vsinstr.exe and vsperfmon.exe command lines tools to generate coverage data. See Code Coverage with Visual Studio.
Once you have the code coverage files, you need to get TeamCity to report the data. This article should get you started, in particular, look under the "Configure TeamCity to display statistics" header.
It is possible to export/print Visual Studio test results in some document format, maybe including test details?
Thanks
I don't know MSTest all too good, but you can run the Visual Studio tests via the Gallio framework (which is free, you can get it here), and that gives a very nice (and very detailed) test report.
HTH!