Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude files from Xcode code coverage report

Is there any way to exclude files in XCode code coverage.

I did research and found some tools here - Exclude Files/Lines of code in Xcode 7 Code Coverage

But all these are third party tools. Is there any way we can do it in xcode it self??

like image 590
Swapnil Avatar asked Jun 17 '16 04:06

Swapnil


People also ask

How do you exclude files from a coverage report?

Solution. In order to exclude a file from the coverage report, the -cc_exclude switch should be used with the asim command.

How do you exclude a class from code coverage?

The easiest way to exclude code from code coverage analysis is to use ExcludeFromCodeCoverage attribute. This attribute tells tooling that class or some of its members are not planned to be covered with tests. EditFormModel class shown above can be left out from code coverage by simply adding the attribute.

How do I see coverage in Xcode?

To see the code coverage report, open the Report Navigator on the left, select the report for the last test run, and open the Coverage tab at the top. You can see that Person.


1 Answers

In Xcode 10.0, you can only exclude complete targets, not individual files.

Here's how to do it: Edit Scheme -> Test -> Options:

Code coverage target selection

like image 133
Catalina T. Avatar answered Sep 18 '22 04:09

Catalina T.