問題描述
我有一個應用程序.應用程序中有一個按鈕,如果單擊該按鈕,將退出應用程序.我正在使用 UIAutomation 工具測試應用程序.我想測試這個按鈕.但是在應用程序退出后,儀器停止給出異常.我想做的是在應用程序存在后,我想重新打開應用程序并繼續進行其余的測試.有沒有其他人遇到過同樣的情況?如果是這樣,您能否分享一下解決方案,如果您找到了?
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?
推薦答案
這是不可能的,因為 Instruments 一旦退出就會失去與應用進程的連接.
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
因此,與其嘗試讓同一個 Instruments 實例重新啟動并重新附加到應用程序,只需運行兩個單獨的腳本,一個用于執行重置和中止,另一個用于檢查應用程序的結果狀態.
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.
這篇關于即使在應用退出后,如何使用 UIAutomation 工具繼續測試 iOS 應用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!