Azure-pipelines-tasks: PublishCodeCoverageResults could not find file

Created on 24 Dec 2016  路  5Comments  路  Source: microsoft/azure-pipelines-tasks

Hi,

I am running karma tests and getting cobertura.xml.
I keep getting file not found error:

2016-12-24T18:21:41.5365253Z ##[error]System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\a\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\1.0.17\coverage'.
20

Starting 'Publish-CodeCoverage' cmdlet
2016-12-24T18:21:41.9972815Z ##[error]System.ArgumentException: File 'coverage/cobertura.xml' does not exist or is not accessible.

my publish testresults task is working correctly, it is in the same directory. Is my configuration wrong? Do I need to add another task before doing so?

Test

Most helpful comment

@tanvi-soni I just ran into the same problem. File 'cobertura-coverage.xml' does not exist or is not accessible.. When inspecting the assets of the build, the file is located in the root dir of my project.
As summary file path I specified cobertura-coverage.xml, report directory and additional files field is blank.

screen shot 2018-08-01 at 16 38 47

All 5 comments

Can you check if the cobertura.xml file is getting generated in the above path.
Also, can you share the value you have specified in summaryFile parameter of publish code coverage task.

Hi,
Any update on the same?

@tanvi-soni I just ran into the same problem. File 'cobertura-coverage.xml' does not exist or is not accessible.. When inspecting the assets of the build, the file is located in the root dir of my project.
As summary file path I specified cobertura-coverage.xml, report directory and additional files field is blank.

screen shot 2018-08-01 at 16 38 47

I'm also getting this same issue - I can publish the code coverage file as an artifact so it is there, but I'm getting the two errors:
##[error]Unable to process command '##vso[codecoverage.publish codecoveragetool=Cobertura;summaryfile=UploadTool/coverage/cobertura-coverage.xml;]' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
##[error]File 'UploadTool/coverage/cobertura-coverage.xml' does not exist or is not accessible.
Is there a reason it would not be accessible?

@rldcampbell @yss14 @akankshagaur
I had the same problem. Looks like you have to specify the full path, not a relative one in the file location.

This did not work:
results/coverage-results.xml

This did work:
$(System.DefaultWorkingDirectory)/results/coverage-results.xml

Was this page helpful?
0 / 5 - 0 ratings