scaly
scaly

Reputation: 605

Xcode 12.3: .xcappdata specified by Test Plans not loading into simulator

I set up a new test target for my app useing Xcode Test Plans to specify an .xcappdata file to use for each target. We run the tests in iPad & iOS Simulators, which get recreated from scratch prior to each test run.

However, Xcode never actually copies over the app data (such as com.ourCompany.ourApp.plist, and other files) from the .xcappdata file into the appropriate directories of the simulator container in ~/Library/Developer/CoreSimulator/Devices/SIMULATED_DEVICE_GUID/data/Containers/Data/Applications/OUR_APP'S_CONTAINER_GUID/.

So our tests fail because, for example, a fresh app .plist gets generated instead of using the one from our .xcappdata, resulting in UserDefaults settings values not matching expectations.

Am I doing something wrong? How can we get this to actually work...?

I have found multiple other threads, such as this one on Apple Dev Forums from four years ago, and several on Stack Overflow such as this post, that indicate that this feature has been broken since at least Xcode 6.

But... didn't they just add the per-target .xcappdata feature as part of Test Plans in Xcode 11? How could it already be broken again in Xcode 12.3? Does Apple not to have tests around their own Test Plans feature?

I hope someone can enlighten me... is it a permissions issue? A regression due to Big Sur? Do I need to add some cryptic executable (buried within the uncountable subfolders in /Applications/Xcode.app/Contents/Some/Deeply/Nested/Toolchain/usr/bin) into Security & Privacy > Privacy > Full Disk Access?

Any help would be much appreciated... thanks!

I did find the following workarounds, but neither seems very scalable:

Upvotes: 3

Views: 344

Answers (0)

Related Questions