Skip to content →

Tag: unit testing

Inline Code Coverage Metrics

Well this was a timely find! My teammates and I were just sitting around the big screen this past week doing a code review and wondering what those numbers were along the right margin of the Xcode source view.

Code coverage in Xcode
Xcode Code Coverage (

Mark Dalrymple explains:

Lines of code that were run during the test are displayed normally. Lines of code that never got run are given a shaded background. The gutter on the right-hand side of the source editor shows how many times that particular line of code was run during the test.

Mark also shares a cool tip for preventing the loading of your UI when running tests, by adding this line to your AppDelegate’s application(_: didFinishLaunchingWithOptions:) method just before your main storyboard is loaded:

if NSClassFromString(”XCTestCase”) { 
  return true 
Leave a Comment