Controlling dotCover filters via XML file - NUnit 3, dotCover, TeamCity 10
Background and Platform: Our dev teams are using TeamCity Enterprise 10.0.4. There are a number of builds set up for various projects. I'm configuring mine to run NUnit 3 tests and use dotCover to report on code coverage. The project is a .NET, MVC website and REST service. The source code is in Git, hosted on our Team Foundation Server box.
Need: There is a bunch of boilerplate code added to typical .NET projects that I'd like filtered out from dotCover. In the NUnit build step in the build configuration, I have something like this for "Filters:" -> "Assembly filters:":
+:*
-:type=MyCompany.MyWebsite.Api.App_Start.NinjectWebCommon
-:type=MyCompany.MyWebsite.Api.Areas.HelpPage.*
-:type=MyCompany.MyWebsite.Api.FilterConfig
-:type=MyCompany.MyWebsite.Api.Global
-:type=MyCompany.MyWebsite.Api.MainAutoMapperProfile
-:type=MyCompany.MyWebsite.Api.NinjectDependencyResolver
-:type=MyCompany.MyWebsite.Api.NinjectDependencyScope
-:type=MyCompany.MyWebsite.Api.RouteConfig
-:type=MyCompany.MyWebsite.Api.ValidateRequestObjectActionFilterAttribute
-:type=MyCompany.MyWebsite.Api.WebApiConfig
Basically, I want to ignore all the garbage under project\App_Start as well as .cs files generated by NuGet packages, etc. I'll need to add at least as many exclusions for the .Web project, part of the same solution.
I want devs to be able to adjust dotCover coverage without needing administrative permissions on TeamCity. I'd also like to create a build that multiple projects can use. Obviously things get complicated if I have a bunch of hard-coded references to specific assemblies. Maybe I could use some wildcards (i.e. change "-:type=MyCompany.MyWebsite.Api.App_Start.NinjectWebCommon" to "-:type=*.Api.App_Start.NinjectWebCommon" so other projects can use the build config as is).
Question: Is it possible to check in an XML file containing dotCover filters which is passed to TeamCity when calculating code coverage? Is there a better alternative?
Please sign in to leave a comment.
Hi Brent,
While dotCover accepts an xml file for coverage, this is the method teamcity actually does it (it creates the xml file and uses it), so it's not possible to pass a separate one. You might be able to create your own script for coverage and reporting back to teamcity using the pointers here: https://confluence.jetbrains.com/display/TCD10/Manually+Configuring+Reporting+Coverage
Other than that, please feel free to open an issue in our tracker here if you would like to see the option to pass a provided XML implemented: https://youtrack.jetbrains.com/issues/TW