How To Check Test Coverage

If you write tests it’s useful to know what your test coverage is.

But how to check if you covered everything?

Fortunately, there is an Xcode mechanism for that but it’s not turned on by default.

First, you need to write some tests but I guess you have some.

Next, click on your project …

and click Edit Scheme…

On the left panel select Tests and Options category.

At the bottom, you have a checkbox called Gather coverage for, check it. You can select a specific target or leave it by default with all targets.

Now run your tests with command (⌘) + U shortcut.

When tests finished open Navigator and in the Report category, you have info about Coverage.

In my case, it’s not impressive but I work on it 🙂