我有一个应用程序.应用程序中有一个按钮,如果单击该按钮,将退出应用程序.我正在使用 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模板网!
在没有应用程序源代码的情况下使用 Instruments 测Using Instruments to test an iOS app without having source code to the application(在没有应用程序源代码的情况下使用 Instruments 测试
KIF:如何自动运行/压力测试 iOS 应用程序以找出罕KIF: How to auto-run/stress test an iOS app to find the cause of a rare UI bug?(KIF:如何自动运行/压力测试 iOS 应用程序以找出罕见 UI 错
如何为自动化的 android 测试提供登录凭据?How to provide login credentials to an automated android test?(如何为自动化的 android 测试提供登录凭据?)
如何修复错误“无法从 sw_vers 输出检测 Mac OS X 版How to fix error quot;Could not detect Mac OS X Version from sw_vers output: #39;10.12 #39;quot; from Appium(如何修复错误“无法从 sw_vers 输出
如何跨多个活动测试 Android 应用程序?How do you test an Android application across multiple Activities?(如何跨多个活动测试 Android 应用程序?)
无法更改 Xcode 4.5 中的目标成员身份可见性Can#39;t change target membership visibility in Xcode 4.5(无法更改 Xcode 4.5 中的目标成员身份可见性)