Reputation: 9513
Code coverage in Xcode is a testing option supported by LLVM. When you enable code coverage, LLVM instruments the code to gather coverage data based on the frequency that methods and functions are called. The code coverage option can collect data to report on tests of correctness and of performance, whether unit tests or UI tests.
I would like to generate a code-coverage report via Xcode.
I've looked at gcovr http://gcovr.com.
...or is it more prudent to generate a report via xcodebuild?
Is there a tutorial or guide to generating a report via Xcode 8+?
Upvotes: 1
Views: 3478
Reputation: 6030
There is -enableCodeCoverage YES
option for xcodebuild
. You can easily see possibilities of xcodebuild
command by typing xcodebuild --help
.
Here are Apple guildelines on code coverage usage: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/07-code_coverage.html
You can even see the coverage report directly from Xcode.
Upvotes: 2