Hola, estoy tratando de obtener cobertura de código con .net5 en canalización azul.
Ejecutar pruebas (no todo el archivo)
Starting test execution, please wait... A total of 1 test files matched the specified pattern. Results File: /home/vsts/work/_temp/_fv-az43-964_2021-08-25_08_31_59.trx Attachments: /home/vsts/work/_temp/f5dd5e9f-e260-437d-80ef-4fb917215b09/coverage.cobertura.xml Passed! - Failed: 0, Passed: 16, Skipped: 0, Total: 16, Duration: 732 ms - /home/vsts/work/1/s/sda2021_webapi/Test/sda2021_api.tests/bin/Release/net5.0/sda2021_webapi.tests.dll (net5.0) Result Attachments will be stored in LogStore Run Attachments will be stored in LogStore Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting Async Command Start: Publish test results Publishing test results to test run '5152'. TestResults To Publish 16, Test run id:5152 Test results publishing 16, remaining: 0. Test run id: 5152 Published Test Run : https://dev.azure.com/sda-shs/Bratislava2021/_TestManagement/Runs?runId=5152&_a=runCharts Async Command End: Publish test results Finishing: Dotnet run testsPublicar pruebas (no todo el archivo)
##[warning]Multiple file or directory matches were found. Using the first match: /home/vsts/work/_temp/_fv-az43-964_2021-08-25_08_31_59/In/fv-az43-964/coverage.cobertura.xml /opt/hostedtoolcache/dotnet/dotnet /home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.189.0/netcoreapp2.0/ReportGenerator.dll -reports:/home/vsts/work/_temp/**/coverage.cobertura.xml -targetdir:/home/vsts/work/_temp/cchtml -reporttypes:HtmlInline_AzurePipelines 2021-08-25T08:32:03: Arguments 2021-08-25T08:32:03: -reports:/home/vsts/work/_temp/**/coverage.cobertura.xmlY por supuesto mi tubería
task: DotNetCoreCLI@2 displayName: Dotnet run tests inputs: command: "test" projects: "**/xxxxx/*.tests.csproj" arguments: '--configuration Release /p:CoverletOutputFormat=cobertura --collect:"XPlat Code Coverage" --no-build' testRunTitle: "xxxx" - task: PublishCodeCoverageResults@1 displayName: "publish coverage results" inputs: codeCoverageTool: "Cobertura" summaryFileLocation: "$(Agent.TempDirectory)/**/coverage.cobertura.xml"¿Por qué se genera más de un XML? Básicamente estoy equilibrando entre ningún XML y más XML. Simplemente no puedo generar un XML. (en mi localhost genera solo uno) Gracias por cualquier consejo.
Reemplace su PublishCodeCoverageResults con los siguientes pasos:
- task: reportgenerator@4 displayName: 'Merge code coverage reports' inputs: reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' targetdir: '$(Pipeline.Workspace)/coverlet' reporttypes: 'Cobertura' verbosity: 'Verbose' - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage results' inputs: codeCoverageTool: Cobertura summaryFileLocation: '$(Pipeline.Workspace)/coverlet/Cobertura.xml'Y tiene varios archivos, porque probablemente tenga más de un proyecto de prueba.