Code coverage in Xcode

Xcode has added native support for the measurement of the code coverage of tests with version 7. To enable it, select Edit Scheme... in the scheme selector in Xcode:

In the following pop-up window, select the Test phase and check Gather coverage data:

That is all! If you have tried to add the gathering of code coverage in Xcode 6, you will most probably be impressed by how easy this is in Xcode 9. Close the window, and run all the tests to measure the code coverage.

After the tests have finished, select the Report Navigator, ...

Get Test-Driven iOS Development with Swift 4 - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.