Reputation: 62826
I followed the instructions on http://tdc1tfsapp01:8080/tfs/DefaultCollection/SharpTop/_packaging?_a=package&feed=dayforce&package=OrchardCore.Cms.Web&version=1.0.20098.7+1bcd36b1f8efd5484af49f8ec39c21060a64391e&protocolType=NuGet and it does produce a binary coverage result file and surfaces a link to it on the build.
But, I want to convert it to Cobertura in order to publish on the build itself. It is a rather convoluted process, where one needs to:
My problem is that I do not know where the binary result is placed during the build. So, my question is - can we customize its location?
Upvotes: 4
Views: 7691
Reputation: 457
You can set the custom coverage path by using below argument is commands input:
--results-directory D:\Desired\Location\
example:
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: src/folder1/folder2/ProjectTests.csproj
arguments: --results-directory D:\a\_work\_DesiredLocation --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
Upvotes: 3
Reputation: 62826
Found it. Three things need to be done:
DotNetCoreCLI@2 test
command. This prevents it from injecting its own result directory.-r
parameter.Here is how I run the tests:
- task: DotNetCoreCLI@2
name: Test
displayName: Test
inputs:
command: 'test'
publishTestResults: false
arguments: '-c Release --no-build -l trx -r "$(Build.StagingDirectory)\tests" --collect "Code coverage"'
And the coverage result would be $(Build.StagingDirectory)\tests\<SOME GUID>\*.coverage
Upvotes: 3