Xcode9 code coverage is not displayed

半世苍凉 提交于 2019-12-20 10:24:41

问题


I have been trying to get the code coverage for my project using Xcode 9. All test case run successfully but did not generate the code coverage report under Code coverage tab.

I tried following things:

  1. Enable the Gather code coverage in scheme.
  2. Enable Code Coverage Support for my target.
  3. Enable the Show case bundle option.

    Is there extra setting require to check code coverage report ? or should I missed something ? Thanks in advance.


回答1:


Issue Resolve in Version 9.3, to get the code coverage Target -> Test -> Options -> CodeCoverage See image:





回答2:


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.




回答3:


There was known bug on Apple side addressed missed code coverage for UI tests targets (https://openradar.appspot.com/24006783).

Xcode Version 9.3 beta (9Q98q) seems resolves issue as long as Debug executable not enabled in Test schema.

In Xcode build scheme editor Test -> Info tab -> Debugger make sure that checkbox Debug executable is unchecked.

Here is an example project for Bugreport #24006783: https://github.com/vgorloff/Radar24006783




回答4:


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.



来源:https://stackoverflow.com/questions/47157041/xcode9-code-coverage-is-not-displayed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!