My tests are XCTests and I'm using Objective-C instead of Swift.
I've seen some articles that tackle the topic, but the seem focused on older versions of Xcode, for example:
What would be the recommended approach to get code coverage on Xcode 6? Does Apple have something built in for code coverage, maybe via Xcode CI via OSX Server?
Enabling Code Coverage in Xcode Code coverage is enabled in the scheme editor. Click the Covered scheme and choose Edit Scheme.... Select Test on the left and check the checkbox Gather coverage data. That is it.
Code coverage results are displayed in the Coverage tool window, in the Project tool window, and in the editor after you run at least one configuration with coverage. Results of the code coverage analysis are saved to the coverage folder in the IDE system directory.
Press Cmd+9 to open the report navigator, and look for “Coverage” under the most recent test run. This will show the code coverage data that was just collected – open the disclosure indicators so you can see inside User.
Take a look at frankencover.it
Usage:
FTW, it has an easy-to-remember dogue-speak-esque command line interface:
groovy http://appsquickly.github.io/frankencover.it/with --source-dir MyProject/Source
Terminal Output:
HTML Report:
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