Any of you knows how can I get percentage of code coverage in Xcode?. Right now I only see the bars:
I'll really appreciate your help.
To collect code coverage data, run the test suite one more time. 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. swift is completely covered by the unit tests we wrote.
Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.
With that being said it is generally accepted that 80% coverage is a good goal to aim for. Trying to reach a higher coverage might turn out to be costly, while not necessary producing enough benefit. The first time you run your coverage tool you might find that you have a fairly low percentage of coverage.
(View menu > Navigators > Reports or ⌘ - command + 9 ). After you open it, under the latest Test report, you should find a Coverage report, click on that, and it will contain the coverage information of that test run. You can find code coverage report under the Reports navigator.
Just some clarification on where to find these numbers in Xcode 10:
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