25

I'm getting into UI unit testing, and for a couple days now the UI unit testing refuses to start properly. I setup a simple test to click a button, and when I run it, it hangs starting the app before even starting the test.

Note, it always hangs exactly one minute and then proceeds with the test correctly.

If I delete the app from the Simulator device, or clear the entire Simulator's Content and Settings, then the test runs successfully and instantly on the first run. It hangs each time after that until I delete again. This is not great either, as I end up getting new Location approval prompts each time which might interfere with the app.

What's going on here?

t =     0.00s     Start Test
t =     0.00s     Set Up
t =     0.00s         Launch com.domain.appName 
2015-10-06 11:59:24.493 XCTRunner[66707:4085844] Continuing to run tests in the background with task ID 1
t =     0.92s             Waiting for accessibility to load
t =    60.92s             Wait for app to idle
... rest of test runs immediately
Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
Miro
  • 5,307
  • 2
  • 39
  • 64

2 Answers2

0

I am also facing this issue but occasionally. Re-attempt or reboot simulator fixes the issue, but temporarily.

Yogesh Khatri
  • 319
  • 3
  • 7
0

The answer at https://forums.developer.apple.com/thread/15780 worked for me:

Pointing the launch screen at a storyboard that is also used for code, and has connected outlets to a UIViewController subclass. These outlets can't be resolved by springboard while it generates a launch image, and it seems to fail over and over, before timing out after 60 seconds.

One solution is to clear out the launch screen setting. Another solution is to create and add a launch screen to your project by following the instructions at https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW4 reproduced below:

  1. Choose File > New > File.
  2. Under iOS, select User Interface.
  3. Click Launch Screen and click Next.
  4. Enter a filename in the Save As text field, and click Create

Configure your launch screen file using basic UIKit views, such as UIImageView and UILabel objects, and uses Auto Layout constraints.

To set the launch screen file

  1. If necessary, open the “App Icons and Launch Images” section of the General pane.
  2. From the Launch Screen File pop-up menu, choose a launch screen file.
Yoga
  • 1,186
  • 1
  • 13
  • 24