Team City and Visual Studio 2010 and Coverage Tool - visual-studio-2010

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.

Related

Reuse Testconfigurations from VS 2008 in VS 2010?

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!

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.

classes and methods report

Is there any tool or extension to generate a report which contains data about classes and methods? For example, show a summary of all classes and the methods included in each class with the count of both.
I found it in Visual studio. go to the following menu option
Analyze > Calculate Code Metrics for Solution
It will show Code Metrics Result window. From this window choose export to excel and you'll get a report with all the projects, Namespaces, Classes, Methods and some other details about them in Excel file.
NDepend lets you perform all kinds of queries about your code. I can't say I've used it myself, but I would be surprised if it didn't let you generate reports.
See reports generated by NDepend here.
See explanations about NDepend code metrics here.
Also you can get all these result both in Visual Studio 2017, 2015, 2013, 2012, 2010, and also in Visual Studio Team Services.

How do I enable code coverage in Visual Studio 2005?

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.

Export Visual Studio test results in some document / report format?

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!

Resources