Use OpenCover to generate coverage statistics for SonarSloud

This commit is contained in:
lukeIam committed 2018-05-01 15:20:42 +02:00
1 parent 2748148a1d
commit 0d69b5ee62
1 file changed
+14 -1
+14 -1
View File
@@ -34,6 +34,7 @@ install:
else{ else{
$Env:TAG_NAME_WITH_BRANCH_NAME_FALLBACK = $Env:APPVEYOR_REPO_BRANCH $Env:TAG_NAME_WITH_BRANCH_NAME_FALLBACK = $Env:APPVEYOR_REPO_BRANCH
} }
choco install "opencover.portable" -y
before_build: before_build:
- ps: | - ps: |
Try Try
@@ -70,7 +71,8 @@ before_build:
/d:sonar.host.url="https://sonarcloud.io" ` /d:sonar.host.url="https://sonarcloud.io" `
/v:"$Env:GIT_VERSION_TAG" ` /v:"$Env:GIT_VERSION_TAG" `
/d:sonar.login="$Env:SonarQubeToken" ` /d:sonar.login="$Env:SonarQubeToken" `
/d:sonar.cs.nunit.reportsPaths="$env:APPVEYOR_BUILD_FOLDER\TestResult.xml" /d:sonar.cs.nunit.reportsPaths=".\TestResult.xml" `
/d:sonar.cs.opencover.reportsPaths=".\CoverageResult.xml"
} }
} }
build: build:
@@ -107,6 +109,17 @@ after_build:
.\.appveyor\nightlyDetect.ps1 .\.appveyor\nightlyDetect.ps1
.\.appveyor\moveTagForSpecialBranches.ps1 .\.appveyor\moveTagForSpecialBranches.ps1
} }
test_script:
- ps: |
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){
OpenCover.Console.exe -register:user -target:"nunit3-console.exe" -targetargs:".\Tests\bin\Release\Tests.dll --result=.\TestResult.xml;format=AppVeyor" -output:".\CoverageResult.xml"
}
else{
nunit3-console.exe ".\Tests\bin\Release\Tests.dll" --result=".\TestResult.xml;format=AppVeyor"
}
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit3/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResult.xml))
after_test: after_test:
- ps: | - ps: |
if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){ if ($Env:PLATFORM -eq 'x64' -and ($Env:APPVEYOR_PULL_REQUEST_NUMBER -or $Env:APPVEYOR_REPO_BRANCH -eq 'develop')){