XCUITest how to test app update

Background: I have an app that uses keychain to store the sign in information. I would like to perform a UI test to test whether the account is kept signed in after updating the app.


Question: Is there a way to trigger or simulate an app update behavior so that I can perform this in my regression test? If no, what is the suggestion to approach this?


Thanks

Replies

+1 I have the same exact problem. We want to automate tests that verify app state is unchanged after an upgrade


I spent some time researching the current tooling, and as far as I can tell, there is no way to do this in a single test. There's no API exposed in XCUITest that allows for installing an application during a test.


A potential workaround you could try is to write a test that signs a user in, run a script that installs a new app executable to the device/simulator, and run a test that verifies that the user is still signed in. There are a couple obvious downsides to this workaround:

  • It would be more ideal to have this test case encapsulated logically in a single test unit rather than having the test case rely on the execution of two individual test units and a script
  • It's more tedious to write and maintain this workaround (2 UI tests and a script to install an application) than it would be to write a single UI test


Does anyone have any better ideas for testing this case without support for installing an app built into XCTest? Does Apple plan to offer support installing apps to the device in a future release of the XCTest framework?