XCTest The test runner exited with code -1 before finishing running tests

Viewed 860

We are running Xcode 12.4 and keep randomly seeing the following errors when running our XCUITest tests:

The test runner exited with code -1 before finishing running tests

enter image description here

We can rerun the failed tests and they will pass. Does anyone know the cause of this error or how to fix it? I haven't seen it until we upgraded from 11.3 to 12.4, but not sure if it is something specific to 12.4 or not.

1 Answers

I would expect to see a testrunner crash log on device - Check Xcode menu Window > Devices [pick the device] > Device Logs.

Usually this is due to an error like force unwrapping a nil value, but it could also be using all the memory, etc. - anything that would crash a normal program can crash your test too.

Related