更新时间:2023-10-16 11:44:22
这是不可能的,因为乐器失去与应用过程中一旦它退出的连接。
This is not possible because Instruments loses the connection with the app process once it quits.
如果您通过命令行脚本UI自动化,你可以第一个退出该应用程序,然后检查,以确保一切是复位后运行自动化第二脚本。
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.