Sonarqube with gallio openCover - how to?

本文关键字:how to openCover with gallio Sonarqube | 更新日期: 2023-09-27 18:25:37

我正在尝试获得C#单元测试覆盖率
下面是我的声纳设置,但当我运行声纳跑步器时,我看不到任何与将测试覆盖率和浏览器上的结果统一起来它不显示任何单元测试覆盖范围
我的问题是:sonar c#插件页面上说gallio是作为它的一部分安装的。我假设我不需要从外部安装gallio,但当我运行sonar runner时,它会调用gallio来获得覆盖
我做错了什么?

# Required metadata
sonar.projectKey=MyProg    
sonar.projectName=MyProg
sonar.projectVersion=1.0
# sonar.sources=C:/MyProj
sonar.sources=.
sonar.language=cs
# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Additional parameters
# sonar.my.property=value


#Core C# Settings
sonar.dotnet.visualstudio.solution.file=AS.sln
sonar.dotnet.excludeGeneratedCode=true
sonar.dotnet.4.0.sdk.directory=C:/Windows/Microsoft.NET/Framework/v4.0.30319
sonar.dotnet.version=4.0 

#Gendarme
sonar.gendarme.mode=
# Gallio / Unit Tests
sonar.gallio.mode=
sonar.gallio.coverage.tool=OpenCover
sonar.gallio.runner=IsolatedProcess
sonar.dotnet.visualstudio.testProjectPattern=*Test*
sonar.opencover.installDirectory=C:/opencover.4.5.2506/
# FXCop 
sonar.fxcop.mode=skip
# StyleCop 
sonar.stylecop.mode=skip
# NDeps
sonar.ndeps.mode=skip

我没有在声纳日志中找到任何关于gallio的信息:

   c:'Program Files'sonar-runner-dist-2.4'sonar-runner-2.4'bin'..
SonarQube Runner 2.4
Java 1.7.0_40 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: c:'Program Files'sonar-runner-dist-2.4'sonar-runner-2.4'bin'..'conf'sonar-runner.properties
INFO: Project configuration file: C:'cna2'Columbus-NA'ERP'SourceCode'Projects'AS'sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:'cna2'Columbus-NA'ERP'SourceCode'Projects'AS'.'.sonar
INFO: SonarQube Server 4.5
18:30:31.202 INFO  - Load global referentials...
18:30:31.309 INFO  - Load global referentials done: 109 ms
18:30:31.316 INFO  - User cache: C:'Users'vikas.c'.sonar'cache
18:30:31.323 INFO  - Install plugins
18:30:31.433 INFO  - Install JDBC driver
18:30:31.438 INFO  - Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
18:30:32.494 INFO  - Initializing Hibernate
18:30:33.577 INFO  - Load project referentials...
18:30:33.829 INFO  - Load project referentials done: 253 ms
18:30:33.829 INFO  - Load project settings
18:30:34.207 INFO  - Loading technical debt model...
18:30:34.234 INFO  - Loading technical debt model done: 27 ms
18:30:34.236 INFO  - Apply project exclusions
18:30:34.438 INFO  - -------------  Scan Sage AS
18:30:34.442 INFO  - Load module settings
18:30:34.603 INFO  - Language is forced to cs
18:30:34.603 INFO  - Loading rules...
18:30:35.074 INFO  - Loading rules done: 471 ms
18:30:35.091 INFO  - Configure Maven plugins
18:30:35.147 INFO  - Compare to previous analysis (2014-10-06)
18:30:35.153 INFO  - Compare over 30 days (2014-09-06, analysis of 2014-10-06 13:42:43.0)
18:30:35.154 INFO  - No quality gate is configured.
18:30:35.267 INFO  - Base dir: C:'cna2'Columbus-NA'ERP'SourceCode'Projects'AS'.
18:30:35.267 INFO  - Working dir: C:'cna2'Columbus-NA'ERP'SourceCode'Projects'AS'.'.sonar
18:30:35.268 INFO  - Source paths: .
18:30:35.268 INFO  - Source encoding: UTF-8, default locale: en_US
18:30:35.268 INFO  - Index files
18:30:35.599 INFO  - 132 files indexed
18:30:46.573 INFO  - Quality profile for cs: Sonar way
18:30:46.696 INFO  - All FxCop rules are disabled, skipping its execution.
18:30:46.699 INFO  - Sensor QProfileSensor...
18:30:46.704 INFO  - Sensor QProfileSensor done: 5 ms
18:30:46.704 INFO  - Sensor InitialOpenIssuesSensor...
18:30:46.729 INFO  - Sensor InitialOpenIssuesSensor done: 25 ms
18:30:46.729 INFO  - Sensor ProjectLinksSensor...
18:30:46.733 INFO  - Sensor ProjectLinksSensor done: 4 ms
18:30:46.734 INFO  - Sensor VersionEventsSensor...
18:30:46.856 INFO  - Sensor VersionEventsSensor done: 122 ms
18:30:46.856 INFO  - Sensor FileHashSensor...
18:30:46.878 INFO  - Sensor FileHashSensor done: 22 ms
18:30:46.878 INFO  - Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@643926a2...
18:30:46.925 INFO  - 132 source files to be analyzed
18:30:47.818 INFO  - 132/132 source files analyzed
18:30:48.015 INFO  - Sensor org.sonar.plugins.csharp.squid.CSharpSquidSensor@643926a2 done: 1137 ms
18:30:48.015 INFO  - Sensor CPD Sensor (wrapped)...
18:30:48.015 INFO  - DefaultCpdEngine is used for cs
18:30:48.021 INFO  - Cross-project analysis disabled
18:30:48.601 INFO  - Sensor CPD Sensor (wrapped) done: 586 ms
18:30:48.830 INFO  - Execute decorators...
18:30:50.537 INFO  - Store results in database
18:30:53.723 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/SageCNAAS
18:30:53.779 INFO  - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
18:30:53.781 INFO  - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
18:30:53.823 INFO  - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
18:30:53.838 INFO  - -> Keep one snapshot per day between 2014-09-08 and 2014-10-05
18:30:53.839 INFO  - -> Keep one snapshot per week between 2013-10-07 and 2014-09-08
18:30:53.840 INFO  - -> Keep one snapshot per month between 2009-10-12 and 2013-10-07
18:30:53.841 INFO  - -> Delete data prior to: 2009-10-12
18:30:53.849 INFO  - -> Clean Sage AS [id=1]
18:30:53.854 INFO  - <- Clean snapshot 1850
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 23.752s
Final Memory: 16M/675M
INFO: ------------------------------------------------------------------------

Sonarqube with gallio openCover - how to?

首先,您必须定义测试项目模式。sonar/opencover无法识别您的测试二进制文件。其次,如果你使用的是声纳4.3+,你可能想知道声纳已经结束了对gallio和opencover的支持。在这种情况下,您需要从外部导入覆盖率xml来获得覆盖率。请用有关声纳等版本的适当信息来增强您的帖子。