Is there a method to completely close (not background) an app in UITest?

Is there a method to completely close (not background) an app in UITest? This would be useful for testing persistence mechanisms..

Best Answers


  • JohnHardmanJohnHardman GBUniversity mod

    @DavidLavender - Thanks David. That is what I am currently using, but I wasn't sure that this would:

    (a) guarantee that there is no overlap between the two instances running (although I would hope the o/s would take care of this, as on Android the app code includes LaunchMode = LaunchMode.SingleInstance, I'll need to check the iOS code).
    (b) guarantee that any asynchronous tasks would be guaranteed to complete before the new instance fired up (so any application properties are guaranteed to be saved before being read by the new instance).

    As long as it's safe in these respects, StartApp will do the job. Many Thanks.

  • SwatiJainSwatiJain USMember ✭✭

    @DavidLavender said:
    Hi John,

    Without understand the specifics of the test case i cannot be 100% what the correct answer is but based on the high level detail above i'd suggest using the StartApp() with the AppDataMode.DoNotClear explicitly set.


    This should enable you to test persistence by restarting the app with the data stored by the previous session.


    @DavidLavender I tried "AppDataMode.DoNotClear" with ios application and it doesn't seem to store the authentication data from last session.
    Please confirm this will work with ios app using safari webview.

    Below is the command I am using to launch app:-

    return ConfigureApp.iOS.
                               .StartApp (AppDataMode.DoNotClear);
Sign In or Register to comment.