Xcode 10 fails my tests in simulator without any information as to the failure

Viewed 9088

Since upgrading to Xcode 10 my tests (which before the upgrade passed) are no longer being run as far as I can tell. The build succeeds, then the tests fail, but there is no report to say why.

Originally my target OS was 10.3, but I noticed a greyed out iOS11 in the settings, I have since reverted this to 10.3 with no change.

I have restarted my machine and this doesn't seemed to have helped.

Any insight would be helpful.

I do note that this is the inverse of the problem reported here

Thanks

12 Answers

I had the same problem than you and I've found a solution.

In Xcode go to:

Xcode > File > Workspace Settings...

or

Xcode > File > Project Settings...

Change Build System (in shared workspace settings and in per-user workspace settings) from New Build System (default) to Legacy Build System.

Xcode build system

I hope this will help somebody in the future :)

Deleting the app, restarting both Xcode and device worked for me.

This answer seems to have worked much like the poster saw the deployment targets seemed off for the test targets.

The test seem to run fine in an XR simulator, which should be iOS12.

Clean Build Folder helps to me: In Xcode go to Product -> Clean Build Folder

Just in case it helps anybody, I had to choose one of the simulators to run the tests, but not the real device. I don't know why, but Xcode hadn't warned me about that, so check that out too

Using Xcode 11 and iPhoneOS 13 on an iPhone 11 Pro, deleting the "[AppTestsName]-Runner" application from my device seemed to solve the issue.

I had a similar issue. In my case, the problem appeared because I didn't build my app after I added a new framework which I used in tests.

In my case (using carthage), the issue was that some of the frameworks that are required for the test target had been built with Swift 4.1. Doing

$ sudo xcode-select -s <path_to_xcode_10>

$ carthage build <library>

for each of the libraries that were having problems fixed the issue. Hope this helps someone.

If you use cocoapods, one way to solve this is to clear CocoaPods cache, re-download and re-install all pods as indicated at https://gist.github.com/mbinna/4202236

rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update

I had the same problem, the thing is that this started to happen suddenly meaning that a change on the repo is not needed.

By change on the repo I mean do something on workspace settings, run a pod command and definitely not changing the deployment target (I dont believe changing the iOS versions that you are supporting is needed just to be able to run your tests suite).

What it worked for me was deleting the content of DeliveredData folder (different than cleaning project) from the Finder. For this you can see where is is located by going to Xcode->Preferences->Locations Tab.

For me, it was the UI tests that were failing even before running. I had to change the podfile statement for this target from

inherit! :search_paths

to

inherit! :complete

I think this is just relevant to UI tests, not unit tests. The UI tests need to inherit all of the behavior from the parent, not just the search paths.

Check Targets [Build Settings] Search IPHONEOS_DEPLOYMENT_TARGET

Remove IPHONEOS_DEPLOYMENT_TARGET setting

with setting

to

setting removed

Related