I have an app. There is a button in the app, which, if clicked, exits the app. I am testing the app using UIAutomation instruments. I want to test this button. But after the app exits, the instrument stops giving an exception. What I want to do is that after the app exists, I want to reopen the app and continue with the rest of the test. Have anyone else been in the same scenario? If so, can you please share the solution, if you have found any?
This is not possible because Instruments loses the connection with the app process once it quits.
If you are scripting UI Automation from the command line, you can run a second automation script after the first one quits the app that then checks to make sure everything is reset.
instruments \
-D [trace document] \
-t [instruments template] \
/path/to/Bundle.app \
-e UIARESULTSPATH [directory to store test output] \
-e UIASCRIPT reset_the_app.js
instruments \
-D [trace document] \
-t [instruments template] \
/path/to/Bundle.app \
-e UIARESULTSPATH [directory to store test output] \
-e UIASCRIPT check_that_the_app_is_reset.js
So, rather than trying to get the same instance of Instruments to relaunch and reattach to the app, just run two separate scripts, one that does your reset-and-abort, and the other that checks the resulting state of the app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With