ios - 如何使用 UIAutomation 工具继续测试 iOS 应用程序,即使在应用程序退出后也是如此?

标签 ios automated-tests functional-testing ios-ui-automation

我有一个应用程序。应用程序中有一个按钮,如果单击该按钮,将退出应用程序。我正在使用 UIAutomation 工具测试应用程序。我想测试这个按钮。但是在应用程序退出后,仪器停止给出异常。我想做的是在应用程序存在后,我想重新打开应用程序并继续进行其余测试。有没有其他人遇到过同样的情况?如果是这样,您能否分享解决方案(如果您找到了)?

最佳答案

这是不可能的,因为 Instruments 一旦退出就会失去与应用进程的连接。

如果您从命令行编写 UI 自动化脚本,您可以在第一个自动化脚本退出应用程序后运行第二个自动化脚本,然后检查以确保一切都已重置。

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 实例重新启动并重新连接到应用程序,不如运行两个单独的脚本,一个执行重置和中止,另一个检查应用程序的结果状态.

关于ios - 如何使用 UIAutomation 工具继续测试 iOS 应用程序,即使在应用程序退出后也是如此?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10454239/

相关文章:

testing - 寻找 "test execution manager"软件来管理自动化测试

json - Symfony Web 测试用例 JSON

iphone - 是否有无需越狱即可自动测试 iPhone 的工具? (UI 自动化除外)

ios - Swift 不会打印来自通知委托(delegate)的有效负载

django - 在 Django 中测试 "different layers"的最佳实践是什么?

java - 在用于 Selenium 测试的 Maven 项目中使 System.setProperty 平台独立

testing - 集成测试框架?

Ios:应用内购买对话框未出现

ios - Swift - UIButton 改变宽度

ios - iOS Google Places API-编译错误-使用未声明的标识符GMSAutocompleteViewController