我正在尝试构建我们的 c-sharp 解决方案,并使用 dotcover 进行代码覆盖
以下是生成的输出。
C:\Client\DEV\DEV_3.3.0\TEST> SonarScanner.MSBuild.exe begin /k:"Client-3.3.0" /n:"Client-3.3.0" /v:"2.0" /d:sonar.cs.dotcover.reportsPaths="C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport.html"
SonarScanner for MSBuild 4.4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonarqube\msbuild\SonarQube.Analysis.xml`
Loading analysis properties from C:\sonarqube\msbuild\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
15:19:13.733 Updating build integration targets...
15:19:13.766 Fetching analysis configuration settings...
15:19:14.075 Provisioning analyzer assemblies for cs...
15:19:14.077 Installing required Roslyn analyzers...
15:19:14.203 Pre-processing succeeded.
C:\Client\DEV\DEV_3.3.0\TEST>
C:\Client\DEV\DEV_3.3.0\TEST>msbuild ..\source\Clientside.sln
.....
.....
.....
3013 Warning(s)
0 Error(s)
Time Elapsed 00:03:06.10
现在我正在运行 dotcover 代码分析和测试覆盖率
C:\Client\DEV\DEV_3.3.0\TEST>dotcover analyse /ReportType=HTML /Output="C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport.html" /TargetExecutable="C:\Client\DEV\DEV_3.3.0\3rdparty\NUnit.Console-3.9.0\nunit3-console.exe" /TargetArguments="C:\Client\DEV\DEV_3.3.0\TEST\SAClientTest.nunit"
JetBrains dotCover Console Runner 2018.2.3. Build 777.0.20180912.160624
Copyright (c) 2009-2019 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Coverage session started [1/11/2019 3:09:56 PM]
NUnit Console Runner 3.9.0
Copyright (c) 2018 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Microsoft Windows NT 10.0.16299.0
CLR Version: 4.0.30319.42000
Test Files
C:\Client\DEV\DEV_3.3.0\TEST\ClientTest.nunit
Errors, Failures and Warnings
......
......
......
Test Run Summary
Overall result: Failed
Test Count: 83, Passed: 70, Failed: 13, Warnings: 0, Inconclusive: 0, Skipped: 0
Failed Tests - Failures: 0, Errors: 0, Invalid: 0
Start time: 2019-01-11 09:39:58Z
End time: 2019-01-11 09:40:03Z
Duration: 4.932 seconds
Results (nunit3) saved as TestResult.xml
[JetBrains dotCover] Coverage session finished [1/11/2019 3:10:05 PM]
[JetBrains dotCover] Analyzed application exited with code '13'
[JetBrains dotCover] Coverage results post-processing started [1/11/2019 3:10:05 PM]
[JetBrains dotCover] Report generation started [1/11/2019 3:10:05 PM]
[JetBrains dotCover] Report generation finished [1/11/2019 3:10:08 PM]
[JetBrains dotCover] Coverage results post-processing finished [1/11/2019 3:10:08 PM]
这是声纳扫描仪结束操作后的输出。
C:\Client\DEV\DEV_3.3.0\TEST>SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonarqube\msbuild\SonarQube.Analysis.xml
Loading analysis properties from C:\sonarqube\msbuild\SonarQube.Analysis.xml
Post-processing started.
.....
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
INFO: Scanner configuration file: C:\sonarqube\msbuild\sonar-scanner-3.2.0.1227\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\Client\DEV\DEV_3.3.0\TEST\.sonarqube\out\sonar-project.properties
............
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=4ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=3ms
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
........
......
INFO: Source encoding: windows-1252, default locale: en_US
INFO: Index files
INFO: 5 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# [csharp]
INFO: Importing analysis results from C:\Client\DEV\DEV_3.3.0\TEST\null\output-cs
INFO: Sensor C# [csharp] (done) | time=6ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=1ms
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Aggregating the HTML reports from C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\1.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\10.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\100.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\101.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\102.html
INFO: Parsing the dotCover report C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport\src\103.html
......
.....
INFO: Adding this code coverage report to the cache for later reuse: C:\Client\DEV\DEV_3.3.0\TEST\CoverageReport.html
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
***INFO: Total time: 22.134s
INFO: Final Memory: 11M/44M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Line 129 is out of range in the file source/PipeClient.cs (lines: 128)
ERROR:
The SonarQube Scanner did not complete successfully
15:10:44.674 Creating a summary markdown file...
15:10:44.685 Post-processing failed. Exit code: 1
C:\Client\DEV\DEV_3.3.0\TEST>***
最后 10 行是错误
有时,对于相同的代码,它会给我这样的不同错误。我不知道找出原因。
INFO: Source encoding: UTF-8, default locale: en_US
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 14.850s
INFO: Final Memory: 7M/85M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.phases.AbstractPhaseExecutor
ERROR: Caused by: Unable to load component class org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader
ERROR: Caused by: Dangling meta character '*' near index 0
**/src/main/java/com/dell/customtools/integration/td/proxy/**
^
ERROR:
The SonarQube Scanner did not complete successfully
21:11:25.365 Creating a summary markdown file...
21:11:25.369 Post-processing failed. Exit code: 1
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: Execution of SonarScanner for MSBuild failed (exit code 1)
Archiving artifacts
Extended Email Publisher is currently disabled in project settings
Finished: FAILURE
仅供参考,我正在使用以下工具
- Visual Studio 专业版 2017
- dotcover 版本:2018.3.1
- 声纳 - LTS - 6.7.x
PS也尝试过这些解决方案。 stackoverflow 解决方案 ,但没有奏效。