SonarQube不执行C#测试 - 单元测试覆盖小部件显示0

时间:2014-05-26 15:58:49

标签: c# unit-testing sonarqube

我在.NET C#项目上运行Sonar。 显示测量值,但覆盖率小部件显示0.0%且未执行单元测试。

我的配置可能有问题,有人可以帮忙发现吗?

我正在使用TeamCity Enterprise 8.0.4在SonarQube服务器版本3.7.2上运行sonar-runner.bat 2.0版 TeamCity将dotCover设置为覆盖工具。

sonar-project.properties文件包含:

# Project identification values
sonar.projectKey=edd-datamodel-dotnet
sonar.projectName=EDDI DataModel NET

# Info required for Sonar
sonar.sources=.
sonar.language=cs 
sonar.dotnet.visualstudio.testProjectPattern=*Tests.Unit*

# Project Information
sonar.links.homepage=http://localhost/wiki
sonar.links.ci=http://localhost:8080/viewType.html?buildTypeId=bt37
sonar.links.issue=http://localhost/secure/IssueNavigator.jspa?mode=hide&requestId=11509
sonar.links.scm=scm:svn:http://localhost/SVG/repos/Product/Microsoft.Net/EDDI

和执行日志:

DEBUG - Using directory D:\work\9ff348aa7c3c7d93\Barclays.EDD.DataModel.Tests.Unit\bin\Debug for project Barclays.EDD.DataModel.Tests.Unit with buildconfiguration Debug
DEBUG - Executing Gallio program...
DEBUG - - Gallio executable   : C:\Program Files\Gallio\bin\Gallio.Echo.exe
DEBUG - - OpenCover executable: C:\Program Files (x86)\JetBrains\dotCover\v2.1\Bin\dotCover.exe
DEBUG - - Coverage tool       : dotCover
DEBUG - - Runner              : LOCAL
DEBUG - - Report directory    : D:\work\9ff348aa7c3c7d93\.sonar
DEBUG - - Report file         : gallio-report
DEBUG - - Test assemblies     :
DEBUG - D:\work\9ff348aa7c3c7d93\Barclays.EDD.DataModel.Tests.Unit\bin\Debug\Barclays.EDD.DataModel.Tests.Unit.dll
DEBUG - - Working directory   : D:\work\9ff348aa7c3c7d93\.sonar
DEBUG - - dotCover include: 
DEBUG - - dotCover exclude: 
DEBUG - - Coverage report: D:\work\9ff348aa7c3c7d93\.sonar\coverage-report.xml
INFO  - Executing command: C:\Program Files (x86)\JetBrains\dotCover\v2.1\Bin\dotCover.exe a /TargetExecutable=C:\Program Files\Gallio\bin\Gallio.Echo.exe /TargetWorkingDir=D:\work\9ff348aa7c3c7d93\.sonar "/TargetArguments=\"/r:Local\" \"/report-directory:D:\work\9ff348aa7c3c7d93\.sonar\" \"/report-name-format:gallio-report\" \"/report-type:Xml\" \"D:\work\9ff348aa7c3c7d93\Barclays.EDD.DataModel.Tests.Unit\bin\Debug\Barclays.EDD.DataModel.Tests.Unit.dll\"" /Filters=+:module=Barclays.EDD.DataModel;class=*;function=*;+:module=Build;class=*;function=*; /ReportType=TeamCityXML /Output=D:\work\9ff348aa7c3c7d93\.sonar\coverage-report.xml
INFO  - JetBrains dotCover Console Runner v2.1.471.44. Copyright (c) 2009-2014 JetBrains s.r.o. All rights reserved.
INFO  - 
DEBUG - Updating semaphore batch-edd-datamodel-dotnet
INFO  - [JetBrains dotCover] Coverage session started [26/05/2014 15:31:14]
INFO  - 
INFO  - Gallio Echo - Version 3.4 build 11
INFO  - Get the latest version at http://www.gallio.org/
INFO  - 
INFO  - Start time: 15:31
INFO  - Initializing the runtime and loading plugins.
INFO  - Verifying test files.
INFO  - Initializing the test runner.
INFO  - test runner.' flowId='eac27e3d045b896d
INFO  - Running the tests.
INFO  - Running tests.' flowId='eac27e3d045b896d
INFO  - Barclays.EDD.DataModel.Tests.Unit (2s)
DEBUG - Updating semaphore batch-edd-datamodel-dotnet
INFO  - 
INFO  - 
INFO  - Generating reports.
INFO  - Disposing the test runner.
INFO  - Disposed test runner.' flowId='eac27e3d045b896d
INFO  - Stop time: 15:31 (Total execution time: 5.500 seconds)
INFO  - 
INFO  - 0 run, 0 passed, 0 failed, 0 inconclusive, 0 skipped
INFO  - 
INFO  - [JetBrains dotCover] Coverage session finished [26/05/2014 15:31:28]

任何帮助将不胜感激!

谢谢, Eyal

2 个答案:

答案 0 :(得分:0)

这看起来很不寻常

DEBUG - - OpenCover executable: C:\Program Files (x86)\JetBrains\dotCover\v2.1\Bin\dotCover.exe
DEBUG - - Coverage tool       : dotCover

OpenCover可执行文件实际上是OpenCover.Console.exe

您是否尝试运行OpenCover或dotCover?

答案 1 :(得分:0)

我有类似的问题。解决方案是添加:

sonar.gallio.runner=IsolatedProcess

我的sonar-project.properties文件的完整内容:https://sonartfs.codeplex.com/