Search code examples
xcodexcode8xcode-ui-testing

Xcode 8 UI Testing Taking Very Long


I'm writing UI tests in XCode 8 for a very complicated app. I'm discovering several issues, one of them being that each test I run takes several minutes.

The flow for the particular test I'm running isn't even that complicated.

I get many "Wait for app to idle" messages.

Does anyone know why the tests take so long to run, or do you have any suggestions on how I can speed them up? The WWDC demo was basically instant, but that was a very simple app.

Here's an example of what I see, and how long it takes. (The test is also still running!)

t =   504.16s         Wait for app to idle
t =   625.29s         App animations complete notification not received, will attempt to continue.
t =   625.30s         Synthesize event
t =   625.67s         Wait for app to idle

Thanks!

Update: When I slightly interact with the app, while keeping the elements I need visible, like by pulling on a tableview, the tests continue.


Solution

  • Thanks @Oletha - I found the issue, which may be specific to this app:

    After deleting large amounts of code at a time to see where the issue was, we found that we were calling beginRefreshing and endRefreshing on a subclass of UIRefreshControl, on consecutive lines.

    Something about that stalled the UI, enough to hold the app in "Wait for app to idle" for minutes.

    We replaced those two lines with a custom method, and now tests are running normally.