Is Code Coverage Already Working for Swift

Unit test: Is there ways to see code coverage for Swift?

with xcode7, apple will resolve this problem, see https://developer.apple.com/library/prerelease/ios/documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_7_0.html

How do I show code coverage in Swift Packages?

The problem is that you didn't turn on Code Coverage for the library's scheme. Turn it on:

Sample Image

See the checkbox at the bottom: Code Coverage? Check that checkbox.

Now run the package test and coverage will be gathered. The best way to see it, in my experience, is actually in the report navigator:

Sample Image

Why isn't Xcode showing test coverage?

Works fine on my machine:

Sample Image

Sample Image

Don't forget to choose Editor > Show Code Coverage (you didn't mention that in your little checklist).

How to display Xcode code coverage when it's not displaying?

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

image


How to get coverage for private init

Move your String constants to an enum then you won't need a private init.

enum SpecificConstants {
static let foo = "foo"
}

Swift MVVM testing strategy and code coverage questions

Ultimately, I figured out the main issue was that the view model and data manager had somehow gotten added to the test target. After removing them from the test target I was able to make a couple of minor changes and everything is running fine. FYI.



Related Topics



Leave a reply



Submit