6

I am using XCode Version 7.1 (7B91b) on my local MAC. And testing my app on the Simulator iPhone 6 (iOS9).

I have created Unit tests for my app, then I found that the code coverage was about 34%. I decided to create UI tests to increase the code coverage. But unfortunately, the code coverage did not increase.

I made a simple trial,

  1. create a project with NavBarContrl, FirstTabelViewController & SecondTableViewController, keep the unit tests as default

  2. Leave unit tests, add one record in UI Tests to navigate from first table view controller to the second. (I am expecting that Both First/Second Table View Controllers must be highlighted in the final Code Coverage report, right?)

  3. Make sure code coverage is enabled

  4. Run Tests then check code coverage, it is 40%

Take a look on the attached code coverage result, Second View Controller coverage is zero !! although when I was watching the simulator, it did navigate from first view controller to the second one. It can't be zero.

Code Coverage Result

is there anything that I m missing here? I tried to search in Apple official Documentation but cant find any explicit contradiction to have code coverage with UI Testing, any suggestions?

Wael Showair
  • 3,092
  • 2
  • 22
  • 29

1 Answers1

-1

Make sure you have enabled Debug Executable in Test section in your Scheme settings.

It appears that without this option Xcode unable to gather coverage data.

Andriy
  • 2,767
  • 2
  • 21
  • 29