I've tried a new feature of XCode7 - Test Coverage.
Whenever I have a method with guard statement at the beginning report doesn't cover code after it even I hit it multiple times.
To prove it I made a breakpoint in "uncovered code". Then I run the test and made a screenshot. Is it a bug or I'm doing something wrong?
This has been fixed in Xcode 7 Beta 4 (along with the nasty highlighting it used to do):
Related
I updated to Xcode 13 and noticed that the coverage report is not considering some lines like guard, ??operator, curly braces...
ex:
It made the overall coverage decrease a lot without a change. Is anyone facing this issue? Is there a solution?
I can confirm the behavior you describe.
In Xcode 12.5.1:
It correctly shows that both of these methods only have partial coverage (when, of course, you’re only testing one path of execution).
But Xcode 13.0 suggests no coverage for that nil coalescing scenario, even though it really is partially covered:
Clearly, one should attempt to test both scenarios to ensure complete coverage (at which point Xcode 13 will properly indicate this), but this would appear to be a bug in the rendering of the partial coverage, in certain cases, in Xcode 13.0.
I use XCode 7.2 and Swift 2.0, no extra pods for testing, just XCTestCase class. I don't have #testable import myApp and adding it doesn't fix my problem.
I have everything set up correctly to see code coverage for my Swift project (I have set it up following this post - How to use code coverage in Xcode 7? ).
And it works, when I run all tests (with Command-U). However, when I try to run a particular test class (e.g. CuriousUITests: XCTestCase) or a specific test (e.g. testMyFavouriteButton), the coverage shows as if none of the code is covered!
Why does that happen?
I want to be able to see code coverage when running just one test, so that after implementing a new test, I don't have to run all of my tests to see if it indeed does cover what I expected (It just takes too long to run them all).
Thanks for all your help!
da-na
I have enabled code coverage and everything else in my project.
When I tested my app on a simulator, The test passed.
But when I went to check the report, it says that none of my classes and methods are executed? Everything in zero and all my classes and methods have been given he red colours.
Why can't I see any code coverage for my test?
I've noticed that my Xcode 7.1 code coverage results see to be unaffected by any UI tests I've written. I can set a break point to make sure a particular line of code is hit during a UI test, but the coverage statistics don't reflect it properly.
I read in some of the 'beta' notes for Xcode 7.0 that Code Coverage was supposed to extend to UI Testing? Did that get dropped, or is there a setting I'm missing?
You need to Turn on code coverage in the scheme editor for a target.
https://developer.apple.com/library/prerelease/tvos/documentation/ToolsLanguages/Conceptual/Xcode_Overview/CheckingCodeCoverage.html
When I try to test my iOS app the Xcode 7 test navigator shows (null) the second time I run my tests.
The first time it looks normal:
However, as I run the tests again the 12 tests turn into a single test named (null) and it feels like the test cases aren't really run anymore, they just succeed every time after 1 millisecond.
I'm using Kiwi for the tests, but it feels more like something going wrong in Xcode7. I don't remember having this problem in Xcode6. The only thing that consistently solves the problem seems to be an Xcode reboot.
Has anyone had this issue as well?
I have just experienced the same issue. Commenting out the test class name so the test would not build and then putting the test class name back fixed it for me.