简体   繁体   English

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

[英]SonarQube does not execute C# tests - Unit Tests Coverage widget shows 0

I'm running Sonar on a .NET C# project. 我在.NET C#项目上运行Sonar。 The measurements are showing, but the coverage widget is showing 0.0% and no unit tests are executed. 显示了测量结果,但是coverage小部件显示了0.0%,并且没有执行任何单元测试。

I'm probably doing something wrong in my configuration, can someone help spot it? 我的配置可能做错了什么,有人可以帮忙发现吗?

I'm using TeamCity Enterprise 8.0.4 to run sonar-runner.bat version 2.0 on a SonarQube server version 3.7.2 TeamCity sets dotCover as the coverage tool. 我正在使用TeamCity Enterprise 8.0.4在SonarQube服务器3.7.2版上运行sonar-runner.bat 2.0版,TeamCity将dotCover设置为覆盖工具。

The sonar-project.properties file contains: 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

and the logs of the execution: 以及执行日志:

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]

Any help would be appreciated! 任何帮助,将不胜感激!

Thanks, Eyal 谢谢,Eyal

This looks unusual 这看起来很不正常

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

The OpenCover executable is actually OpenCover.Console.exe OpenCover可执行文件实际上是OpenCover.Console.exe

Are you trying to run OpenCover or dotCover? 您是否要运行OpenCover或dotCover?

I had similar problem. 我有类似的问题。 The solution was to add: 解决方案是添加:

sonar.gallio.runner=IsolatedProcess

Full content of my sonar-project.properties file: https://sonartfs.codeplex.com/ 我的sonar-project.properties文件的完整内容: https ://sonartfs.codeplex.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM