ExcludeAttributes 在 NCover 1.5.8 中不起作用
我创建了一个名为“CoverageExcludeAttribute”的自定义属性,并将其放置在我想要从代码覆盖率分析中排除的类之上。但排除不起作用。覆盖率报告显示了 Test dll 以及所有引用的程序集(其中包括包含排除属性的类)的覆盖率,
<UsingTask TaskName="NCoverExplorer.MSBuildTasks.NCover" AssemblyFile="$(Libraries)\NCoverExplorer.MSBuildTasks.dll"/>
<Target Name="NcoverCoverage">
<NCover ToolPath="C:\Program Files\TestDriven.NET 3\NCover\1.5.8"
CommandLineExe="D:\Xunit\xunit.console.exe"
CommandLineArgs="MyTestDll"
WorkingDirectory="MyWorkingDirectory"
excludeAttributes="CoverageExcludeAttribute"
LogFile="coverage.log"
/>
</Target>
我是否遗漏了某些内容?
谢谢。
I created a custom attribute called "CoverageExcludeAttribute", and placed it above the classes which I want to exclude from my code coverage analysis. But the exclusions doesn't work. The coverage report shows coverage for the Test dll along with all the referenced assemblies (which includes classes containing the exclusion attribute)
<UsingTask TaskName="NCoverExplorer.MSBuildTasks.NCover" AssemblyFile="$(Libraries)\NCoverExplorer.MSBuildTasks.dll"/>
<Target Name="NcoverCoverage">
<NCover ToolPath="C:\Program Files\TestDriven.NET 3\NCover\1.5.8"
CommandLineExe="D:\Xunit\xunit.console.exe"
CommandLineArgs="MyTestDll"
WorkingDirectory="MyWorkingDirectory"
excludeAttributes="CoverageExcludeAttribute"
LogFile="coverage.log"
/>
</Target>
Am I missing something?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您的属性是在全局命名空间中定义的,或者在
excludeAttributes
中提供完整的类型名称。Make sure that your attribute is defined in a global namespace or provide a full type name in
excludeAttributes
.如果您使用 .NET Framework 4.0,则可以使用现有属性
:
在使用 NCover 1.5.8 时,这对我来说似乎工作得很好,至少在使用 NCoverExplorer 时是这样。该属性是自动选取的。
If you are using .NET Framework 4.0 you can use existing attribute
From namespace:
That seems to be working fine for me when using NCover 1.5.8 at least when using NCoverExplorer. This attribute is picked up automatically.