Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrating dotcover results in teamcity #20

Open
harishrathi opened this issue May 16, 2016 · 5 comments
Open

integrating dotcover results in teamcity #20

harishrathi opened this issue May 16, 2016 · 5 comments
Assignees

Comments

@harishrathi
Copy link

harishrathi commented May 16, 2016

I am not able to directly integrate dot-cover results in sonar-qube, but below commands did indeed helped

$Files= Get-ChildItem %system.teamcity.build.tempDir% ` 
    -Filter coverage_dotcover*.data ` 
    | where-object {$_.length -gt 50} ` 
    | Select-Object -ExpandProperty FullName 

$snapshot =[string]::Join(";",$Files) 

& %teamcity.tool.dotCover%\dotCover.exe merge ` 
  /Source=$snapshot ` 
  /Output=%env.TEMP%\dotCoverReport.dcvr` 


& %teamcity.tool.dotCover%\dotCover.exe report ` 
  /Source=%env.TEMP%\dotCoverReport.dcvr ` 
  /Output=%sonar.coverageReport% ` 
  /ReportType=HTML


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

@samgooch
Copy link

Did you have any luck with this?

@Linfar
Copy link
Member

Linfar commented Aug 17, 2018

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.

@Linfar Linfar self-assigned this Aug 17, 2018
@axel3rd
Copy link
Contributor

axel3rd commented Feb 26, 2019

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

@salamoun
Copy link

salamoun commented Dec 8, 2021

%teamcity.tool.dotCover%\dotCover.exe works only on Windows Agents :(

@axel3rd
Copy link
Contributor

axel3rd commented May 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants