I have been trying to get the code coverage for my project using Xcode 9. All test cases run successfully but did not generate the code coverage report under the Code coverage tab.
I tried the following things:
Enable the Gather code coverage in the scheme.
Enable Code Coverage Support for my target.
Enable the Showcase bundle option.
Is there an extra setting require to check the code coverage report ? or should I miss something? Thanks in advance.
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.
On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window. Show Code Coverage Coloring in the Code Coverage Results window. By default, code that is covered by tests is highlighted in light blue.
Configure coveragePress Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment | Coverage. Define how the collected coverage data will be processed: Show options before applying coverage to the editor: show the Code Coverage dialog every time you run a new run configuration with code coverage.
Code coverage enforcementlink To enable this, open the Karma test platform configuration file, karma. conf. js , and add the check property in the coverageReporter: key. The check property causes the tool to enforce a minimum of 80% code coverage when the unit tests are run in the project.
Issue Resolve in Version 9.3, to get the code coverage Target -> Test -> Options -> CodeCoverage See image:
If you want to see the code coverage in the right side of the editor, make sure you have Show Code Coverage selected in the Editor drop down menu.
I'm pretty sure they just moved the code coverage to a new location. I'm seeing it now as part of the report navigator (see screenshot below).
To get there, first turn on code coverage support (edit scheme -> test -> options -> check code coverage box) then look on the left hand side of xcode at the navigator. At the top you will see a bunch of icons. Click on the last one on the right (it looks like a message bubble).
Within that tab, you will see all the tests you ran. Within each test is a "coverage" item. Click on one of those to get the coverage report for that specific test.
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