Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS 2013 - No Code Coverage Results

I have a TFS 2013 environment setup and I am trying to get TFSBuild to gather my code coverage results after a build.
The tests are running fine, but no matter what I try, I get a message saying "No Code Coverage Results".

I have read about a "Code Coverage Analysis Service", but that is not installed on my servers at all and I can't seem to find it anywhere.

I have gone through the process of the builds to make sure I have the "Automated Tests --> Test Source --> Run settings --> Type of run settings" set to CodeCoverageEnabled, but no matter what else I try, I can't get the results to get published to the Analysis services database so I can run the Code Coverage Reports.

I have tried a run settings file, but with no luck, so I have taken that out of the equation.

Any help would be greatly appreciated!

like image 867
tcmg.digiorgio Avatar asked Jun 03 '14 13:06

tcmg.digiorgio


People also ask

How do I get code coverage results?

Code coverage results are displayed in the Coverage tool window, in the Project tool window, and in the editor after you run at least one configuration with coverage. Results of the code coverage analysis are saved to the coverage folder in the IDE system directory.

How do I show cover coverage with code cover?

Well, just click on Toggle Code Coverage Highlighting under the Tools menu: you will see all the lines covered by tests in green, and all the ones that aren't covered by any tests in red. This will help you speed up your development and find out possible bugs and flaws earlier.

How do I check code coverage in Visual Studio using resharper?

Ctrl+U D commands. You can use this command to run coverage analysis of unit tests from the editor, from the Solution Explorer, or from unit tests sessions.


2 Answers

I just figured out what the problem was that my Code Coverage weren't been calculated on the buildserver. I figured this out with the helpdesk of Microsoft and it is a small UI bug.

Steps to reproduce: Create a new build definition.

  1. Go to the process tab of the build definition and select the solution file to build.
  2. Now expand the "Automated tests" section and expand the "Test Source".
  3. Expand the "Run settings" and change the "Type of run settings" from "Default" to "CodeCoverageEnabled".
  4. Save the builddefinition and run your build.
  5. Examine build results and notice no code coverage is calculated.

To fix this issue use the other ui of the build definition.

  1. Select the "Automated tests" node.
  2. Now in that row on the right you will see a button with "...". Hit it and a dialog will be opened.
  3. Hit "Edit" to edit your test source. You will see that Code coverage is enabled. If not select it.
  4. Hit Ok and Ok again to close the two dialogs.
  5. Now save the build definition and run your build again.

Now the code coverage does get calculated!!! The microsoft helpdesk has submitted a bug to the development team and it will be fixed I guess the next release. Small bug but it cost me more then two days to find the bug!

like image 112
LockTar Avatar answered Oct 11 '22 22:10

LockTar


Do you have a Premium or ultimate visual studio installed on your build machine? Either of those is required to get code coverage results back to TFS

like image 28
Just TFS Avatar answered Oct 11 '22 20:10

Just TFS