6

Since updating to Xcode 5.1, I have been encountering errors while attempting to run unit tests (XCTestSuite). When I run an individual test method, I get the error Error while reading test scope bundle on the console and no result. When I run the full implementation of the test file, I see:

Unable to get entitlements for client task. Error: Error Domain=NSPOSIXErrorDomain Code=-1 "The operation couldn’t be completed. (POSIX error -1 - Unknown error: -1)"

Then the tests appear to start running as expected.

ThomasW
  • 16,981
  • 4
  • 79
  • 106
Joel Fischer
  • 6,521
  • 5
  • 35
  • 46
  • 1
    I'm seeing this too. Xcode 5.1 – jasonjwwilliams Mar 11 '14 at 21:54
  • 2
    I'm seeing this as well in Xcode CI for subsets of the full unit tests. Super annoying. – Colin Cornaby Mar 12 '14 at 05:37
  • I'm seeing the 'entitlements' issue as well, but only when the tests are run on a device. It occurs for both full and individual test run. Tests run fine on the simulator. Note that I only see this problem for tests that call into FXKeyChain a wrapper for the KeyChain. – Seamus Apr 02 '14 at 12:29
  • Found a similar question with an answer that solved it for me (http://stackoverflow.com/a/22561810/1685851) – Moataz Soliman Apr 06 '14 at 14:30

2 Answers2

4

If you have a test target named something like MyApp Tests (notice the whitespace) try changing the product name on that target to MyApp_Tests instead. The product name will then be MyApp_Tests.xctest instead of MyApp Tests.xctest.

Seems like this is a path issue.

hjaltij
  • 885
  • 6
  • 8
1

I couldn't get it to run single tests by using hjaltij's method but adding a new test target worked for me

TestNavigator > Add New Test Target (Plus Button)

Then create new test classes under this target

Matt Key
  • 95
  • 1
  • 6