在FinalBuilder中为NUnit设置NCover [英] Setting up NCover for NUnit in FinalBuilder

查看:139
本文介绍了在FinalBuilder中为NUnit设置NCover的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已解决:在此问题的底部查找有效的配置

我正在尝试为.NET 4.0 C#项目设置要在我的FinalBuilder项目中使用的NCover,但是我的最终coverage输出文件不包含coverage数据.

I am attempting to set up NCover for usage in my FinalBuilder project, for a .NET 4.0 C# project, but my final coverage output file contains no coverage data.

我正在使用:

  • NCover 3.3.2
  • NUnit 2.5.4
  • FinalBuilder 6.3.0.2004

所有工具都是截至今天的最新官方版本.

All tools are the latest official as of today.

我终于设法哄骗FB在.NET 4.0项目的NCover下运行单元测试,所以我得到了Tests run: 184, ...,这是正确的.

I've finally managed to coax FB into running my unit tests under NCover for the .NET 4.0 project, so I get Tests run: 184, ..., which is correct.

但是,NCover最终的Coverage.xml文件输出几乎为空,如下所示:

However, the final Coverage.xml file output from NCover is almost empty, and looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!-- saved from NCover 3.0 Export url='http://www.ncover.com/' -->
<coverage profilerVersion="3.3.2.6211" driverVersion="3.3.2" exportversion="3" viewdisplayname="" startTime="2010-04-22T08:55:33.7471316Z" measureTime="2010-04-22T08:55:35.3462915Z" projectName="" buildid="27c78ffa-c636-4002-a901-3211a0850b99" coveragenodeid="0" failed="false" satisfactorybranchthreshold="95" satisfactorycoveragethreshold="95" satisfactorycyclomaticcomplexitythreshold="20" satisfactoryfunctionthreshold="80" satisfactoryunvisitedsequencepoints="10" uiviewtype="TreeView" viewguid="C:\Dev\VS.NET\LVK.IoC\LVK.IoC.Tests\bin\Debug\Coverage.xml" viewfilterstyle="None" viewreportstyle="SequencePointCoveragePercentage" viewsortstyle="Name">
  <rebasedpaths />
  <filters />
  <documents>
    <doc id="0" excluded="false" url="None" cs="" csa="00000000-0000-0000-0000-000000000000" om="0" nid="0" />
  </documents>
</coverage>

FB日志中的输出为:

The output in FB log is:

...
***************** End Program Output *****************

Execution Time: 1,5992 s

Coverage Xml: C:\Dev\VS.NET\LVK.IoC\LVK.IoC.Tests\bin\Debug\Coverage.xml
NCover Success

我对NCover的FB步骤的配置:

My configuration of the FB step for NCover:

  • NCover什么?:NUnit测试范围
  • 命令:C:\Program Files (x86)\NUnit 2.5.4\bin\net-2.0\nunit-console.exe
  • 命令参数:LVK.IoC.Tests.dll /noshadow /framework:4.0.30319 /process=single /nothread
    • 注意:我尝试使用和不使用/process/nothread选项
    • NCover what?: NUnit test coverage
    • Command: C:\Program Files (x86)\NUnit 2.5.4\bin\net-2.0\nunit-console.exe
    • Command arguments: LVK.IoC.Tests.dll /noshadow /framework:4.0.30319 /process=single /nothread
      • Note: I've tried with and without the /process and /nothread options
      • 注意:我已经尝试仅列出程序集的名称,包括扩展名和扩展名.

      FB步骤的文档无济于事,因为它仅列出每个属性的次要句子,而无法提供示例或故障排除提示.

      The documentation for the FB step doesn't help, as it only lists minor sentences for each property, and fails to give examples or troubleshooting hints.

      由于我想将覆盖率结果放入NDepend中以运行构建时分析,因此我希望该文件包含我需要的信息.

      Since I want to pull the coverage results into NDepend to run build-time analysis, I want that file to contain the information I need.

      我也在使用 TestDriven ,如果我右键单击解决方案文件并选择"Test with NCover",NCover-explorer会打开覆盖数据,如果我要求我向其显示包含覆盖文件的文件夹,则在其中存在一个.xml文件,其结构与上述结构相同,只包含所有应包含的数据在那里,所以我拥有的工具肯定能够生产它.

      I am also using TestDriven, and if I right-click the solution file and select "Test with NCover", NCover-explorer opens up with coverage data, and if I ask it to show me the folder with coverage files, in there is an .xml file with the same structure as the one above, just with all the data that should be there, so the tools I have is certainly capable of producing it.

      有人知道我在这里配置错误吗?

      Has anyone an idea of what I've configured wrong here?

      已解决:以下配置终于对我有用.它会在构建的开始结果页面上生成代码覆盖率的基本统计信息,并提供指向包含所有内容的详细报告的链接.

      Solved: The following configuration finally worked for me. It produces a code coverage basic statistics on the start results page for a build, with a link to a detailed report with everything.

      由于我将单元测试项目命名为与它测试的项目相同,因此仅以.Tests为后缀,因此我将其从代码覆盖范围中排除.另外,我只需要专门包括自己的程序集(所有程序集均以LVK开头),否则我会得到TeamCity运行程序加载的某些程序集,这对覆盖率统计有轻微的影响.

      Since I name my unit test projects the same as the project it tests, only with a .Tests suffix, I've excluded those from the code coverage. Also, I had to specifically include only my own assemblies (which all start with LVK.) otherwise I would get some assemblies loaded by the TeamCity runner, which slightly impacted my coverage statistics.

      首先,我安装了最新的工具(截至本次编辑):

      First, I installed latest of the tools (as of this edit):

      • NCover 3.4.8
      • TeamCity 5.1.2
      • NUnit 2.5.5

      TeamCity的构建屏幕上的配置如下:

      The configuration on the build-screen in TeamCity is then as follows:

      • 目标:重建
      • 配置:调试
      • 平台:任何CPU
      • .NET覆盖率工具:NCover(3.x)
      • .NET运行时:.NET Framework 4.0,版本:本机
      • NCover 3的路径:%system.ncover.v3.x64.path%(这是Windows 2008 Server R2 64位)
      • 其他NCover参数:

      • Targets: Rebuild
      • Configuration: Debug
      • Platform: Any CPU
      • .NET Coverage Tool: NCover (3.x)
      • .NET Runtime: .NET Framework 4.0, Version: Native
      • Path to NCover 3: %system.ncover.v3.x64.path% (this is Windows 2008 Server R2 64-bit)
      • Additional NCover Arguments:

      //ias LVK.*
      //eas .*Tests
      //eas LVK\.CodeQuality
      //ea LVK\.CodeQuality\.IgnoreCodeCoverageAttribute
      

    • 其他NCover报告参数:

    • Additional NCover Reporting Arguments:

      //or FullCoverageReport:Html:{teamcity.report.path}
      

    • NUnit运行器:NUnit 2.5.5

    • NUnit Runner: NUnit 2.5.5

      推荐答案

      据我所知,NCover无法涵盖.NET 4.0的测试.他们宣布了.NET 4.0的新版本,但尚未发布.

      As far as I know, NCover is not capable of covering tests for .NET 4.0. They announced a new version for .NET 4.0 but it is not there yet.

      在此处查找相关信息.我个人没有完成此任务的经验...

      Find info on the subject here. Personally I have no experience with this task...

      更新:他们发布了具有.NET 4.0支持的NCover 3.4.也许您可以尝试一下.

      Update: They released NCover 3.4 with .NET 4.0 support. Perhaps You give it a try.

      这篇关于在FinalBuilder中为NUnit设置NCover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆