Gaining insights through code coverage

Code Coverage is a tool in Xcode that is used to gain insights into how much of your code you are testing with your test suite. It tells you exactly which parts of your code were executed during a test and which parts of your code were not. This is extremely useful because you can take focused action based on the information provided by Code Coverage.

To enable Code Coverage, open the scheme editor through the (Product | Scheme) menu:

Select the Test action and make sure the Gather coverage checkbox on the Options tab is checked:

You can also press Cmd + to open the scheme editor quickly.

After doing ...

Get Mastering iOS 12 Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.