Breakpoints ignored in unit tests

With the latest Xcode 9.3.1 (and 9.3, haven't tried earlier), breakpoints are ignored in unit tests. This is really annoying. Any suggestions?
Thanks.

Replies

With the latest Xcode 9.3.1 (and 9.3, haven't tried earlier), breakpoints are ignored in unit tests.

I’m not sure what’s going on with your setup but I’m not seeing this problem. To verify this I did the following:

  1. Using Xcode 9.3 on macOS 10.13.4, I created a new app from the iOS > Single View App template, making sure to check Include Unit Tests.

  2. In the app I added a dummy class for testing (code below).

  3. In the test case subclass I modified

    testExample
    to call that method (code below).
  4. I set a breakpoint on the

    NSLog
    .
  5. I ran the test on the simulator and it hit the breakpoint.

Please repeat this test on your Mac and let us know how you get along. If you see the same behaviour, you know that the problem your seeing is specific to your setup. In contrast, if this test fails for you then you know that there’s something specific to your environment that’s causing the problem.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
import Foundation

class Test {
    static func test() {
        NSLog("test")
    }
}
func testExample() {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
    Test.test()
}