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??
Solution. In order to exclude a file from the coverage report, the -cc_exclude switch should be used with the asim command.
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.
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.
In Xcode 10.0, you can only exclude complete targets, not individual files.
Here's how to do it: Edit Scheme -> Test -> Options
:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With