即使在应用退出后,如何使用 UIAutomation 工具继续

How to continue testing an iOS app, using UIAutomation instrument, even after the app exits?(即使在应用退出后,如何使用 UIAutomation 工具继续测试 iOS 应用?)
本文介绍了即使在应用退出后,如何使用 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 应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)