Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use code coverage in Xcode 7?

Tags:

xcode

xcode7

I know about new feature in Xcode 7 - Code Coverage. I know how to turn it on:

go to Edit scheme -> Test -> Info tab -> enable Gather coverage data.

I did it, run tests, and... Where is Test Report for my tests?

like image 876
Bartłomiej Semańczyk Avatar asked Jun 28 '15 06:06

Bartłomiej Semańczyk


People also ask

How do I use code coverage in Xcode?

Running Tests and Coverage Locally in Xcode To enable code coverage, click the scheme editor in the toolbar. Select the CodecovDemo scheme and choose Edit Scheme. Select the Test action on the left. Check the Code Coverage box to gather coverage data.

How do I show test coverage in Xcode?

To view the coverage reports: Select the Report Navigator in the navigator pane on the left (⌘8) Select the latest Test run in the navigator pane. Select the Coverage tab in the editor.

How do I run code coverage?

To calculate the code coverage percentage, simply use the following formula: Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.

How do I increase swift code coverage?

So, go to the Product menu and choose Scheme > Edit Scheme. Next, choose the Test scheme and activate its Options tab. Finally, check the Code Coverage box, so that Xcode will gather code coverage data while your tests are running.


1 Answers

Since you turned it on in your scheme, and then build and test:

enter image description here

enter image description here

Go to your Report navigator

enter image description here

Then select your last test:
enter image description here

Finally choose Coverage tab:
enter image description here

like image 64
Bartłomiej Semańczyk Avatar answered Sep 21 '22 01:09

Bartłomiej Semańczyk