iOS with Swift and Github actions does not show any test coverage

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
  • Scanner command used when applicable (private details masked)
  • Languages of the repository
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce

Hello all,
I’m working on an iOS project using Sonarcloud of course and Github actions. I created a new iOS project with a single struct class and associated tests to achieve a greater than 0.0% test coverage. Here is the Xcode test coverage from the local environment,

Now the same project produces the following output in sonarcloud,

I have not been able to register any test coverage for the test coverage quality gate. I used the same setup as specified in this post SonarCloud - Swift code quality scan through GitHub actions with no change. An example of how to run an iOS project with Github actions and have it analyzed by Sonarcloud would be much appreciated.

Hi,

Welcome to the community!

Could you share/point us to your analysis logs?

 
Ann

For sure. Here they are,
logs_128.zip (19.5 KB)

Hi,

It’s not clear to me from the logs that you’re creating a test report and passing it in to analysis…?

 
Ann

I see. So that is the prescribed way this has to work? I have to produce the test report using Xcode and then passing it to Sonarcloud for analysis?

Does Sonarcloud have a complete example documentation on how this is done? I’ve only seen pieces of documentation such as, sonar-scanning-examples/README.md at master · SonarSource/sonar-scanning-examples · GitHub and the link I originally posted in this thread.

I also saw Swift is available for automatic analysis as per, Automatic Analysis | SonarCloud Docs, however when I went to change the settings in the project I did not see an automatic analysis option. Am I just missing the location to switch to automatic analysis?

Thanks in advance for the information.

Hi,

Yes, you need to produce the coverage report and feed it in. Which is why you won’t get coverage data with automatic analysis.

The docs describe how to manually enable automatic analysis.

 
HTH,
Ann

Ok. That helps. As far as the docs for automatic analysis, I don’t see an option to force it as per the image below. Is it just me interpreting the documentation to literally, or is the ability to force the automatic analysis not available? Thank you very much for the time spent on this thread.

Hi,

Hmm… Something is certainly off here. I’m not an expert in this area, so I’ve called for help. Hopefully they’ll be along soon.

BTW, this started with test coverage, which you will not get with automatic analysis. That’s still what you want?

 
Ann

Oh thanks Ann. Test coverage is the priority and Automatic Analysis was simply something I wanted to try to experiment and possibly eliminate a variable. Happy to try a different method and a little more direction before I head off into the darkness (so to speak) is much appreciated.

  • Phil

Hi Phil,

With the understanding that you’re not so interested in automatic analysis, I’m going to call off the experts.

 
Ann