Skip to content

SonarQube not showing coverage report for cobertura coverage file generated using xcresultparser #56

Open

Description

@SurendraMetrobank

Hi Team,
xcresultparser works very well for generic code coverage file.. Azure pipeline shows test coverage where as
generated cobertura code coverage file (uploaded to SonarQube cloud) not showing coverage report..

This is how I use to generate cobertura.xml for code coverage

xcresultparser -o cobertura {build_dir}/ResultBundles/XXXXXXX.xcresult > {sonar_directory}/cobertura.xml

Any suggestions to fix this issue please

Best regards

Activity

  1. a7ex commented on Jun 11, 2025

    @a7ex
    Owner

    Try to provide the project root, so that the absolute paths to the files can be converted to relative path names. Sonarqube requires relative path names rooting in the directory which you provide to the sonar scanner als source root. Provide the same source root to xcresultparser using the -p or --project-root switch.
    E.g.
    --project-root "work/myApp/"

  2. SurendraMetrobank commented on Jun 11, 2025

    @SurendraMetrobank
    Author

    thank you for assisting, I am going to try it now

  3. SurendraMetrobank commented on Jun 11, 2025

    @SurendraMetrobank
    Author

    Hi @a7ex ,

    it seems like by adding --project-root, it fixes file name however class name is showing as name space e.g.

    Should be like this?

    SonarQube cloud not showing coverage yet

    Regards,
    Surendra

  4. a7ex commented on Jun 11, 2025

    @a7ex
    Owner

    It seems so. I do not use cobertura format myself and don't even know how/where to test it. I feed sonarqube with the generic format for coverage.
    That is: I use the -c switch and as format I use "xml" and the --project-root thingie as well.
    So:
    xcresultparser -o xml -c --project-root project/root test.xcresult

  5. SurendraMetrobank commented on Jun 11, 2025

    @SurendraMetrobank
    Author

    Actually our pipeline is pre-configured with cobertura to feed sonarqube,
    Do you use azure dev ops (I mean azure pipeline) to feed sonarqube, if yes, could you please let me know which tool you use in pipeline, possibly I will try to use same with the generic format for coverage

    thank you

  6. SurendraMetrobank commented on Jun 12, 2025

    @SurendraMetrobank
    Author

    Hi @a7ex ,

    Is there any suggestion / solution to update class name in cobertura coverage xml file?

    Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions