1
votes

Here's my set up:

One Xcode 8 Workspace project Swift Framework with lots of UI code (UIViewControllers, etc.) Objective C Example App

For both projects, the Code Coverage setting is checked in the Test scheme.

I would like to run automated UI tests using the Example App to exercise code in the Framework project. This works. However, I don't get any code coverage for the referenced framework.

There's quite a lot of UI code, so it would be very useful to get these code coverage numbers.

I'm using Xcode 8.2.1 (but I've also tried in Xcode 8.3 beta 1).

Any tips appreciated.

2

2 Answers

0
votes

Code coverage flag in Xcode is found by Product -> Scheme -> Edit Scheme Select Test from the left menu Click on the checkbox for gather code coverage.

Next time you run your tests, you'll see the coverage in the Report Navigator, and selecting the test that just ran.

0
votes

Xcode 10 version 10.2 beta now has support for capturing code coverage with embedded frameworks run under the context of an app running UI tests :)

https://developer.apple.com/download/