Subito-it / SBTUITestTunnel

Enable network mocks and more in UI Tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Randomly receiving Waiting for startup block completion timed out (NSInternalInconsistencyException)

alexnot95 opened this issue · comments

Randomly receiving error during app launch.
[SBTUITestTunnel] Waiting for startup block completion timed out (NSInternalInconsistencyException)

Using:

  • Connected SBTUITestTunnel via SPM
  • M1 chip
  • MacOs version 13.2
  • XCode version 14.2
  • default IPC proxy

What does this error mean? And how I can avoid it? Maybe it is possible to increase SBTUITunneledApplicationDefaultTimeout value and it can help somehow? Because I see that default timeout is 30, and I have these numbers in console log:

[SBTUITestTunnel] IPC tunnel did connect after, 32.125881s

[SBTUITestTunnel] Tunnel ready after 32.129435s

As I see this error throws due to a too big timeout?

if (CFAbsoluteTimeGetCurrent() - self.launchStart > SBTUITunneledApplicationDefaultTimeout) {
    return [self shutDownWithErrorMessage:[NSString stringWithFormat:@"[SBTUITestTunnel] Waiting for startup block completion timed out"] code:SBTUITestTunnelErrorLaunchFailed];
}

This error is absent after running test again. I know there is an expected behaviour in XCUITest that some time the app needs more time to launch() and set up testing session, so I think it would be nice to have such possibility to increase SBTUITunneledApplicationDefaultTimeout, if it's possible now can you please explain how I can do it? Thanks

Establishing connection should be much faster since you're running on a pretty updated machine. Are you doing expensive setups in the launch block? What happens if you disable the debugger?

Screenshot 2023-02-27 at 09 34 22

While your connection times are unusually high, it is recommended in general when running UI tests to be resilient to random failures by implementing some kind of automatic retry logic.

@tcamin yeah, we have a lot of launchArguments + launchEnvironments + other server start command, so I turned off debugger and still sometimes receiving this error

[SBTUITestTunnel] IPC tunnel did connect after, 44.323653s
[SBTUITestTunnel] Tunnel ready after 44.326734s
[SBTUITestTunnel] Shutting down with error: '[SBTUITestTunnel] Waiting for startup block completion timed out'

So, I saw this behavior before (long time to set automation session on tests without mock library) maybe it's possible to increase SBTUITestTunnel default timeout? I also have retry strategy in my current testplan, but I think it's better to have possibility to increase default timeout if someone need it, cuz retries took more time to pass test suite

Wouldn't it be worth investigating which parts of your launch block take so much time? Maybe there is space for optimization there. We have pretty complex tests setup as well and the connection to the tunnel takes on average 5s. You mention you need to launch another mock server maybe that can be done before calling launchTunnel()?