NCover 1.5.8 / NCoverExplorer 1.4.0.7 手动排除非常不稳定
我尚未安装 NCover 3 的许可证,并且仍在我的构建服务器上运行 1.5.8。我试图排除我不想包含在报告中的完整程序集和特定类,因为它们人为地降低了覆盖率结果。
在 NCoverExplorer 中,我正在使用这些选项,因为“选项”选项卡中有一个覆盖范围排除部分,您可以在其中指定完整的命名空间。我进入了完全合格的班级,但由于某种原因,只有少数人被排除在外,我不明白为什么。例如,当我将 System.ComponentModel.Composition 添加到列表中时,它永远不会被排除!
这是否只是 1.5.8 中的一个错误,我现在必须忍受它,因为它是测试版并且不再受支持?尽管我确实有服务器的新许可证,但我希望能够在家里用我的个人计算机进行一些覆盖。
我发现了一篇非常棒的关于使用 CoverageExcludeAttribute 的文章 使 NOver 自动跳过那些标有此属性的类/方法。这是最好的选择吗?
I haven't yet installed my license of NCover 3, and am still running 1.5.8 on my build server. I am trying to exclude full assemblies and specific classes that I don't want included in the report, because they are artificially lowering the coverage results.
In NCoverExplorer, I was playing around with the options because there is a coverage exclusions section in the Options tab where you can specify full namespaces. I've entered the fully qualified classes, and for some reason, only a handful of them get excluded, and I cannot figure out why. For example, when I add System.ComponentModel.Composition to the list, it never gets excluded!
Is this just a bug in 1.5.8 that I have to live with for now, since it is a beta and also no longer supported? Although I do have a new license for the server, I'd like to be able to do some coverage at home on my personal computer.
I found a really great article on using a CoverageExcludeAttribute to make NCover automatically skip those classes / methods that are marked with this attribute. Is this the best option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试使用正则表达式来包含/排除程序集 -
//ias AuctionSniper([.\w]*?)(?
包括以 AuctionSniper 开头但不以 Tests 结尾的所有程序集,例如 AuctionSniper.Main.exe
您可以指定多个以分号分隔的模式。
或
//ias .*vendorsupplied.*;.*tests
这适用于 NCover 3 - 如果它适用于免费/社区版本,您可以尝试一下。
Did you try using regular expressions to include/exclude the assemblies -
//ias AuctionSniper([.\w]*?)(?<!Tests)
includes all assemblies that begin with AuctionSniper but don't end with Tests e.g. AuctionSniper.Main.exe
You can specify multiple patterns separated by semicolons.
or
//ias .*vendorsupplied.*;.*tests
This works with NCover 3 - you can give it a try if it works for the free/community edition.
实现这一目标的一种方法是同时使用“包含在覆盖范围内的程序集”选项。这让我可以忽略 System.ComponentModel.Composition。然而,排除大多数其他类和命名空间仍然不起作用。有点奇怪的是,当我排除整个类时,它只排除方法,而不排除任何包含的类。
One way to get part way there is to also use the "assemblies to include in coverage" option. This allowed me to ignore System.ComponentModel.Composition. However, exlcuding most of the other classes and namespaces still doesn't work. It's a little odd how when I exclude an entire class, it only excludes the methods, but not any of the contained classes.