Search code examples
iosxcodejenkinscode-coveragexcode-ui-testing

Xcode 7.3.1 UITests Code Coverage always at 0%


I have two separate targets for Unit Testing and UI Testing in my project besides the main app . These two targets have separate schemes so that i can run them on my CI server separately. I check "Gather Code Coverage" in both of this schemes. Initially i made sure everything is working from XCode by building and running these two schemes separately using "Cmd + U" and coverage data is shown properly for both of these schemes....

In my Jenkins CI i have separate jobs for these two schemes using fastlane, Unit Test scheme is working fine and generating reports. But the UI Test Scheme always shows 0% coverage report no matter what. I don't know what am doing wrong.

Somewhere i read about UI Tests depends on Unit Tests in order for the code coverage, is that true ? If it is true then should i run Unit Tests Before performing UI Tests ?

Thanks in advance.


Solution

  • But the UI Test Scheme always shows 0% coverage

    UI testing doesn't cover any code. It can't see your code. It has never heard of your code. It knows nothing of your code. It has nothing to do with your code! It merely clicks buttons and reads the interface of your app from the outside. In effect, all it can "see" is the screen.