Attribute filter syntax for code coverage in TeamCity
Asked Answered
H

2

9

Anyone knows the syntax for excluding code from coverage in Teamcity? I am using the ExcludeFromCodeCoverageAttribute on certain methods and want those excluded. It works well in Visual Studio but I don't understand how to get the same behavior in TeamCity. The Field I am trying to configure is located in MsTest -> .Net Coverage -> Attribute Filters: I have tried this:

-:ExcludeFromCodeCoverageAttribute 

and this

-:ExcludeFromCodeCoverage
Hillie answered 18/9, 2012 at 18:26 Comment(0)
H
18

After trying out a few variations this worked:

-:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute
Hillie answered 19/9, 2012 at 5:52 Comment(3)
this doesnt work for me. can you confirm that you are decorating for example Class1 with [ExcludeFromCodeCoverage] and then TeamCity does not include Class1 in the coverage results??Vanhorn
the issue is I dont see the 'Attribute Filters` textarea in TeamCity. looks like you need teamcity > 7.1 (see confluence.jetbrains.com/display/TCD7/JetBrains+dotCover)Vanhorn
As to your first comment yes I can confirm itHillie
C
3

Make sure you add this filter inside Attribute Filter:

-:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute

enter image description here

Cuspid answered 13/5, 2015 at 19:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.