Closed pranavbhatt closed 7 months ago
Could you please share your JaCoCo file? You can send it privately via email: reportgenerator@palmmedia.de
@danielpalme sent the link to take a look at the jacoco file.
Problem here is that the class SurveyRequestDateHelper
appears twice in the JaCoCo file.
If you update to the latest release 5.2.5, it will work with the duplicate class as well.
Thank you @danielpalme I will rename one of the files to check if it works and report back.
@danielpalme
PublishCodeCoverageResults@1
to generate the report. I am able to see the coverage in the Code Coverage Tab.File 'SomeFile.java' does not exist (any more).
, I inspected the jacoco index.html by downloading it on my localmachine and I am able to browse individual files from jacoco html. Is it because pathToSources
is not setup properly ?When you are using PublishCodeCoverageResults@1
please read these instructions:
https://github.com/danielpalme/ReportGenerator/wiki/Integration#attention
By default the report gets regenerated by PublishCodeCoverageResults@1
I ran reportGenerator plugin first to convert the jacoco to cobertura Task
- task: reportgenerator@5
displayName: Jacoco Report Converter
condition: succeeded()
continueOnError: true
inputs:
reports: '$(Build.SourcesDirectory)/sources/dev/awareai-test-coverage-report/target/jacoco/jacoco.xml'
targetdir: '$(Build.ArtifactStagingDirectory)/publish/coverage'
sourceDirs: '$(Build.SourcesDirectory)/sources/dev'
reporttypes: 'HtmlInline_AzurePipelines;Cobertura'
Debug Log
##[debug] -license:
/usr/bin/dotnet /mnt/vss/_work/_tasks/reportgenerator_be803a55-9253-4895-a525-be570d86f161/5.2.5/tools/net6.0/ReportGenerator.dll -reports:/mnt/vss/_work/1/s/sources/dev/awareai-test-coverage-report/target/jacoco/jacoco.xml -targetdir:/mnt/vss/_work/1/a/publish/coverage -reporttypes:HtmlInline_AzurePipelines;Cobertura -sourcedirs:/mnt/vss/_work/1/s/sources/dev -historydir: -plugins: -assemblyfilters:+* -classfilters:+* -filefilters:+* -verbosity:Info -title: -tag:20240425.5+MAN_4521932-reportgen_#18509423 -license:
##[debug]Agent environment resources - Disk: / Available 190916.00 MB out of 253873.00 MB, Memory: Used 14064.00 MB out of 32094.00 MB, CPU: Usage 2.53%
...
2024-04-25T09:26:16: File 'ActComponentValueExtensionDao.java' does not exist (any more). <<< files not present
2024-04-25T09:26:16: File 'ActConversationDaoJpa.java' does not exist (any more).
>>> continues for all files <<<
...
2024-04-25T09:26:25: Writing report file '/mnt/vss/_work/1/a/publish/coverage/Cobertura.xml'
2024-04-25T09:26:26: Writing report file '/mnt/vss/_work/1/a/publish/coverage/index.html'
2024-04-25T09:26:26: Report generation took 15.3 seconds
##[debug]Exit code 0 received from tool '/usr/bin/dotnet'
##[debug]STDIO streams have closed for tool '/usr/bin/dotnet'
Publish Task
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
continueOnError: true
condition: succeeded()
inputs:
summaryFileLocation: '$(Build.ArtifactStagingDirectory)/publish/coverage/Cobertura.xml'
pathToSources: '$(Build.SourcesDirectory)/sources/dev'
reportDirectory: '$(Build.ArtifactStagingDirectory)/publish/coverage'
codeCoverageTool: Cobertura
failIfCoverageEmpty: true
env:
DISABLE_COVERAGE_AUTOGENERATE: 'true' # Local environment variable
Debug Log
##[debug]codeCoverageTool=Cobertura
##[debug]summaryFileLocation=/mnt/vss/_work/1/a/publish/coverage/Cobertura.xml
##[debug]reportDirectory=/mnt/vss/_work/1/a/publish/coverage
##[debug]additionalCodeCoverageFiles=undefined
##[debug]failIfCoverageEmpty=true
##[debug]System.DefaultWorkingDirectory=/mnt/vss/_work/1/s
##[debug]pathToSources=/mnt/vss/_work/1/s/sources/dev
##[debug]disable.coverage.autogenerate=true <<<< auto generate disabled
##[debug]disabling auto generation
I also tried directly using PublishCodeCoverageResults@1:
File Doesn't exits.
I will upload the screenshot in the folder for both cases.Your setup seems correct. Are you sure, that the sourcedirs is correct: sourceDirs: '$(Build.SourcesDirectory)/sources/dev'
?
Does (for example) the following file exist: /mnt/vss/_work/1/s/sources/dev/com/awareai/analytics/activepivot/ClientCubeManagerData.java
?
I tried your conriguration on my machine and it works for me. I created a dummy file com/awareai/analytics/activepivot/ClientCubeManagerData.java
and it was correctly read by ReportGenerator.
Regarding PublishCodeCoverageResults@1:
With autogenerate disabled: This report looks like the default JaCoCo report
*
so that directories within the top level dir could be searched for the file, or do we need to give a comma separated list of all java source file directories? You'll need to supply a list of directories (separated by ;
).
@danielpalme It worked after supplying a ;
list of directories. It would be nice to have something like : sourceDirs: '$(Build.SourcesDirectory)/sources/dev/**/src/main/java'
.
Some users have used this pattern, but i think it doesn't work.
Hi Team,
I am getting the following error while trying to convert a jacoco report to cobertura in azure devops pipeline:
I have the following task in my pipeline:
I have a sample jacoco coverage file which I can send for further inspect if needed.