Code coverage result is not accurate to real coverage in Xcode 7

前端 未结 5 802
清歌不尽
清歌不尽 2021-02-02 12:18

I am running test cases in application with enabled code coverage data Xcode 7 Beta 2. But I am able to get only few files coverage data while my all test cases are running succ

5条回答
  •  甜味超标
    2021-02-02 12:35

    I checked at Apple developers forums for the subject and after reading through various posts I guess I came across the solution.

    In order for the thing to work it is necessary to:

    1. Remove all your application source files from the test target
    2. In your unit-test sources put @testable import
    3. Re-build and re-run tests

    I tested this out with my current project, and the results are much better.

    Original solution recipe can be found at: http://natashatherobot.com/swift-2-xcode-7-unit-testing-access/

    Also it seems that the functionality is a bit raw-ish, hence bugs possible, and Apple suggests submitting bug reports when things do not work as expected:

    I've personally seen code coverage results for some very large projects. Right now the support works best for applications and frameworks. If that's what you're testing, then it would be best if you could file a bug report at https://bugreport.apple.com so that we can investigate your particular circumstances. For that matter, a bug report would be a good thing no matter what type of project you have. If possible, it's best to actually in the project with the report. If you can't do that, describe its setup in as much detail as possible. Pictures are good.

    Original thread: https://forums.developer.apple.com/message/9733#9733

提交回复
热议问题