3

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.

reutsey
  • 1,743
  • 1
  • 17
  • 36
  • Are you able to deduce where it is doing this? Is it doing it in the same place or test repeatedly? Is it completely random? Does this happen on multiple machines? In CI? – Mike Collins May 27 '21 at 17:47
  • Happens on several of our machines and so far from what i have seen, its been completely random on which tests it fails on so thats why i'm having a hard time determining the cause. It doesn't give me any more information than that error message when it occurs as well :( – reutsey May 27 '21 at 20:16
  • I've not seen this and neither has Google. Can you share more info (maybe code?) on how you're launching your app? Any special arguments, launch states, etc.? Which OS are you targeting? Phone? Pad? – Mike Collins May 27 '21 at 20:56

3 Answers3

0

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.

David Eison
  • 1,367
  • 12
  • 19
0

I've experienced this today.

In my case, I was overriding an async setUp function, this one:

  override func setUp() async throws {
    try await super.setUp()

And the solution obviously is to have the setup done in a normal function:

  override func setUp() {
    super.setUp()

Also, avoid calling assertions in the setup. Have it done in your custom test functions.

Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95
0

I found that having a Task { } in the test method causing that! , used async in the test function declaration instead

func testSomething async {
  await somethingElse()
}
Mohamed Emad Hegab
  • 2,665
  • 6
  • 39
  • 64