Open harishrathi opened 8 years ago
Did you have any luck with this?
Unfortunately I have little resources for the plugin. It becomes even worse knowing that SonarQube has tons of integrations with different tools which I could support. I will leave this ticket to track but can promise nothing on its timeline.
On TeamCity 2018.2.2 and/or bundled dotCover 2018.1.4, the .dcvr
files seems directly in env.TEMP
directory => the PowerShell script start should be:
$Files= Get-ChildItem %system.teamcity.build.tempDir% `
-Filter "*.dcvr" `
| where-object {$_.length -gt 50} `
| Select-Object -ExpandProperty FullName
%teamcity.tool.dotCover%\dotCover.exe
works only on Windows Agents :(
Since TeamCity 2022.10 and depreciation of MSBuild runner in favor of .NET runner, the dotCover dcvr
files are produced in the temps/agentTmp
directory, which hasn't dedicated variable to be referenced => PowerShell script could be:
Write-Output "--- Retrieve 'dcvr' files to consider ---"
$Files = Get-ChildItem %env.TEMP%/../agentTmp -Recurse -Filter "*.dcvr" | where-object {$_.length -gt 50} | Select-Object -ExpandProperty FullName
Write-Output "$Files"
Write-Output "--- Generate string from list ---"
$Snapshot =[string]::Join(";",$Files)
Write-Output "$Snapshot"
Write-Output "--- Merge all 'dcvr' files in unique report ---"
& %teamcity.tool.dotCover%\dotCover.exe merge /Source=$Snapshot /Output=%env.TEMP%\sonarqube-dotCoverReport.dcvr
Write-Output "--- Generate HTML report understandable by SonarQube ---"
& %teamcity.tool.dotCover%\dotCover.exe report /Source=%env.TEMP%\sonarqube-dotCoverReport.dcvr /Output=%env.TEMP%\sonarqube-dotCover.html /ReportType=HTML
With Additional parameters in SonarQube analysis for MSBuild step:
/d:sonar.cs.dotcover.reportsPaths=%env.TEMP%\sonarqube-dotCover.html
I am not able to directly integrate dot-cover results in sonar-qube, but below commands did indeed helped
I had took them from this SO answer
Can you have some option on UI which provides options for user to import coverage reports from... lets say dotcover or opencover etc, if user selects dotcover it should run above/some other appropriate script in background to generate results in a format that sonarqube understands