Xcode UI Testing on device

Is it possible to run UI tests on a device? I'm trying to do this right now, but it keeps complaining about code signing issues. My tests run fine in the simulator, but if I can run an app, I get this message:


None of the valid provisioning profiles allowed the specified entitlements: com.apple.developer.ubiquity-kvstore-identifier, keychain-access-groups, com.apple.developer.icloud-container-identifiers, com.apple.developer.icloud-services, com.apple.security.application-groups, com.apple.developer.ubiquity-container-identifiers.


As far as I can tell, there isn't any way to specify these entitlements in the UI Test target, since there is no "Capabilities" tab there, and there is no way to speciy an app ID that we can create new provisioning profiles against.


Any ideas how I should go about this? Really need to run some tests on device; the simulator isn't good enough for rmy tests.

Actually managed to get it to run on device after messing around with the original target's code signing and scheme (needed the Test scheme to run in Debug mode, and removed the entitlements file from the UI Test target). Now it starts to run on the device, but doesn't get very far, before crashing with this message:


2015-08-28 17:41:32.352 XCTRunner[2368:439401] The bundle “CJournalUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.

2015-08-28 17:41:32.353 XCTRunner[2368:439401] (dlopen_preflight(/var/mobile/Containers/Bundle/Application/03159F5D-D4C9-4CF6-BE67-05AFC2E9BA43/CJournalUITests-Runner.app/PlugIns/CJournalUITests.xctest/CJournalUITests): Library not loaded: @rpath/ContactsJournalDataKit.framework/ContactsJournalDataKit

Referenced from: /var/mobile/Containers/Bundle/Application/03159F5D-D4C9-4CF6-BE67-05AFC2E9BA43/CJournalUITests-Runner.app/PlugIns/CJournalUITests.xctest/CJournalUITests

Reason: image not found)



Thanks.

This is most likely not resolving in the test runner:


@rpath/ContactsJournalDataKit.framework/ContactsJournalDataKit


Is that framework really used by your tests? If it is, you will likely have to figure out a different way of bundling and linking with it from the test target.

@zulfishah, did you ever figure out the issue? I'm stuck in a similar spot.

I have the exact same issue when running on real devices. No capabilities tab so cant add the relevant push notification required for the app under test. Any ideas anyone as this seems to be unanswered.

Xcode UI Testing on device
 
 
Q