Simple XCTest for UITest is failing all the time?

Viewed 2545

I start a new project from File -> New -> project

I add a button to ViewController.

I open UITest folder which created by xcode by default. Run the test code.

It fails:

2016-03-16 12:57:09.191 XCTRunner[3511:150419] Continuing to run tests in the background with task ID 1
    t =    10.18s         Assertion Failure: UI Testing Failure - Failed to background test runner.
/Users/Bernard/Desktop/ExampleTestApplication/ExampleTestApplicationUITests/test2.m:27: error: -[test2 testExample] : UI Testing Failure - Failed to background test runner.
2016-03-16 12:57:12.789 XCTRunner[3511:150419] *** Terminating app due to uncaught exception '_XCTestCaseInterruptionException', reason: 'Interrupting test'

Now I add a break point as follow:

enter image description here

Now test is successful! Anyone can explain the reason?

2 Answers
Related