google/EarlGrey

Unable to run sample tests

Megubit opened this issue · 0 comments

I'm trying to get the sample project tests running, but I'm encountering some issues. I'm still fairly new when it comes to UI tests, so I'm not sure if I'm doing something wrong.

I followed the Running the Functional Tests guide.
Now if I try to build and run the app on my device, it will run successfully, however, if I try to run any of the tests I get the following error:

FunctionalTests-Runner[32129:1238658] Running tests...
FunctionalTests-Runner[32129:1238658] The bundle “FunctionalTests.xctest” couldn’t be loaded. Try reinstalling the bundle.
FunctionalTests-Runner[32129:1238658] (dlopen(/var/containers/Bundle/Application/FunctionalTests-Runner.app/PlugIns/FunctionalTests.xctest/FunctionalTests, 0x0109): tried: '/var/containers/Bundle/Application/FunctionalTests-Runner.app/PlugIns/FunctionalTests.xctest/FunctionalTests' (code signature in <F9225F...> '/private/var/containers/Bundle/Application/FunctionalTests-Runner.app/PlugIns/FunctionalTests.xctest/FunctionalTests' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.),
'/private/var/containers/Bundle/Application/FunctionalTests-Runner.app/PlugIns/FunctionalTests.xctest/FunctionalTests' (code signature in <F9225F...> '/private/var/containers/Bundle/Application/FunctionalTests-Runner.app/PlugIns/FunctionalTests.xctest/FunctionalTests' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.))

Some suggest enabling Hardened Runtime to fix this kind of error. But this will cause the profile signing to fail, since the FunctionalTestRig.entitlements has a hardcoded application-identifier which doesn't change for my own profile. This can be fixed by manually changing the value to correspond with Xcode generated provisioning profile value. And the signing will work again. but... that also results in the same error, so no progress there.

I'm not sure if I'm making a beginner's mistake here, as I mentioned I'm new in this field, so if anyone could point me out what I'm doing wrong and how to fix this, I would really appreciate it.

I'm using Xcode Version 13.2.1
My device is on iOS 15.4