Search code examples
iosiphonejenkinscode-coverageappium

Code Coverage with Appium for iOS


This question seems to have been asked in a number of different flavours already, and so apologies in advance if I'm just missing something obvious here, but this still isn't clear to me...

I'm running UIAutomation tests using Appium as part of a functional test suite, how do I go about generating code coverage metrics from that suite? Ideally be able to visualise these results in Jenkins then, as part of a CI flow.

I see one guy has a solution here, and I tried implementing this, but the application does not generate ay form of coverage report on shutdown, I was expecting once the app was sent to the background, and subsequently killed, that it would create a dump of the coverage metrics in its current directory, but no joy unfortunately.

There seems to be documentation on the Appium site for doing this with Android, but nothing that I can see for iOS

Appreciate any help with this!


Solution

  • For those who are in a similar situation, we got to the bottom of this by adding the additional steps outlined in the solution here by user "Ed-E G", as well as following the steps in the Github issue.

    We were missing the "Generate Test Coverage Files” and “Instrument Program Flow" settings in XCode.

    Once we added those extra settings, having run the UIAutomation tests through Appium, on shutdown now the app dumps a collection of gcda files in the Derived Data folder, which can be interpreted by gcovr and translated into Cobertura result XML files, to be displayed in Jenkins using the Cobertura plugin