1

I'm working in C# on Visual Studio and my builds run on TFS.

This week I enabled code coverage via my tfs build (Let's assume that I have a .sln Names MySln and there is Tests.MySln there too).

The code coverage via tfs stood on 6% and it's weird because when I ran it with Visual Studio Code Coverage in Test Section I got 70% (which is more correctly). After I downloaded the code coverage results from tfs I noticed that it somehow ran with more dlls that we're using via Nuget.

I tried some changes in .runSettings file, but when I added include only MySln.dll, I got 0 code coverage and I don't want to create runSettings that say exclude all the other dll I saw that ran (I have 15 different slns and I don't want to create a list that might change between projects). I even tried to just enable code coverage without changes of runsettings.

Does someone knows which 'settings' does Visual Studio Test Code Coverage deliver? which config?. Or have another idea how to create .runSettings file?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
Noa Sasson
  • 23
  • 4
  • 1
    This sound like a configuration setting in Visual Studio or .runsettings file not related to TFS side. Have you tried to remote to the build agent and manually run the Code Coverage through the Visual Studio in remote agent directly? Did you get the same result if run it through TFS build server. If so, this behavior should not related to TFS side. – PatrickLu-MSFT Feb 03 '20 at 11:00
  • By default coverage is gathered for all assemblies that have a PDB alongside them. Those shouldn't be part of a standard NuGet package. Deleting those may help. – jessehouwing Feb 04 '20 at 08:26
  • re-write the runSettings file fixed it. I may missed something and didn't notice. – Noa Sasson Feb 04 '20 at 18:45

1 Answers1

1

Update

Op finally re-write the runSettings file fixed it.


This sounds like a configuration setting issue in Visual Studio or .runsettings file not related to TFS side.

Suggest you try to remote to the build agent and manually run the Code Coverage through the Visual Studio in remote agent directly. Check whether you get the same result if run it through TFS build server.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • used this runsettings file and just changed the dll module path https://learn.microsoft.com/he-il/visualstudio/test/customizing-code-coverage-analysis?view=vs-2015&redirectedfrom=MSDN – Noa Sasson Feb 14 '20 at 13:41