即使在应用退出后,如何使用 UIAutomation 工具继续测试 iOS 应用? [英] How to continue testing an iOS app, using UIAutomation instrument, even after the app exits?

查看:27
本文介绍了即使在应用退出后,如何使用 UIAutomation 工具继续测试 iOS 应用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序.应用程序中有一个按钮,如果单击该按钮,将退出应用程序.我正在使用 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 应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆