8

I have serious trouble with unit-tests in XCode. I use XCode 6.4 Build version 6E35b on OS X Yosemite and OS X Capitan.

As a result I have such an error:

_finishWithError:Error Domain=IDEUnitTestsOperationsObserverErrorDomain Code=3 "Test session exited(-1) without checking in." UserInfo=0x7fbfea2b60b0 {NSLocalizedDescription=Test session exited(-1) without checking in.} didCancel: 1

There are already some posts on stack (for instance, Xcode Server CI Bot Test Session exited(-1)), but solution was not found.

I tried to run unit-tests from XCode and from command-line, but too often I had that error. In last case I did 3 steps:

1. Deleting everything from DERIVED_DATA_PATH
2. Installing pods
3. Ran unit-tests with command: xcodebuild test -scheme UnitTests -destination 'platform=iOS Simulator,name=iPhone 5s,OS=8.2' -derivedDataPath 'temp-build-dir' 2>&1

It is a great trouble for me, because I use these tests in common automatic build flow with UI-tests and if they fail, the whole flow fails.

In release notes for XCode 6 there was information from Apple about that bug, and their workaround was to simply rerun tests. It is unacceptable for me, because they run automatically with other tests and it seems to be bad idea to rerun them until they pass or simply run without that error.

Community
  • 1
  • 1

1 Answers1

3

Possible solution

Launch this command in the terminal

sudo /usr/sbin/DevToolsSecurity --enable

What is probably causing the problem

If you launched the tests not on a headless terminal you would see this dialog:

Developer Tools Access needs to take control of another process for debugging to continue. Type your password to allow this.

Anton
  • 726
  • 11
  • 23
  • I have that error randomly, not always. Don't think that problem is in security issues. Moreover, on more fast machines that error is caused many times more rarely, than on slow. I thought that problem could be in timeout of connect, but sometimes it doesn't work with 20 secs, but works after 1 minute. – Алексей Халайджи Aug 07 '15 at 08:20
  • Then I guess you have a different problem :). In my case I was getting "session exited(-1)" 100% of the time. – Anton Aug 07 '15 at 08:35
  • 1
    @Anton I had it once and then unfortunately it stopped working, so now I have 100% of time same error. But I already have devtools enabled. – ReDetection Oct 15 '15 at 11:08
  • I face the same issue as @Anton. – Bartłomiej Semańczyk Oct 12 '16 at 08:49