Код: Выделить всё
steps:
- task: VSTest@2
displayName: 'VsTest - testAssemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*\*test*.dll
!**\obj\**
runSettingsFile: '$/B3API/Main/B3API.Tests/codecoverage.runsettings'
runInParallel: true
runTestsInIsolation: false
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
failOnMinTestsNotRun: true
< /code>
codecoverage.runsettings Файл: < /p>
cobertura
< /code>
Задача для публикации результатов: < /p>
steps:
- task: PublishCodeCoverageResults@2
displayName: 'Publish code coverage results'
inputs:
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.cobertura.xml'
pathToSources: '$(System.DefaultWorkingDirectory)/**/coverage'
steps:
- powershell: |
$coverageFile = "$(System.DefaultWorkingDirectory)/**/coverage.cobertura.xml"
[xml]$coverageData = Get-Content $coverageFile
$coveragePercentage = $coverageData.coverage.@line-rate
# Store the coverage data in a variable
Write-Host "##vso[task.setvariable variable=coveragePercentage]$coveragePercentage"
displayName: 'Store Coverage in variable'
< /code>
Основная проблема - задача для публикации, она не публикует результаты, я думаю, что это связано с тем, что это не находить их в первую очередь. src = "https://i.sstatic.net/d7zcmq4e.png"/>
Любая помощь будет высоко оценена, спасибо!
Подробнее здесь: https://stackoverflow.com/questions/796 ... harp-net-9