Xcode 5.1 breaks some tests

2019-06-18 11:06发布

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.

2条回答
成全新的幸福
2楼-- · 2019-06-18 11:22

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.

查看更多
迷人小祖宗
3楼-- · 2019-06-18 11:35

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

查看更多
登录 后发表回答