【问题标题】:Automation testing with instruments on device使用设备上的仪器进行自动化测试
【发布时间】:2012-09-24 06:19:59
【问题描述】:

我正在尝试关注 this post 从命令行在 iOS 设备上运行 UIAutomation 脚本,但我无法使其工作。

这是我目前使用的命令: 仪器-t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/X/Library/Developer/Xcode/DerivedData/TestiPhoneAutomation2-dyufpxsavtdqkybpagcoawdudzid/ Build/Products/Debug-iphoneos/TestiPhoneAutomation2.app -e UIASCRIPT "/Users/X/Workspaces/TestiPhoneAutomation/test2.js" -e UIARESULTSPATH "/Users/X/Workspaces/TestiPhoneAutomation2/" -w 80bf5b...UDID。 ..dfb52543 -v

它在模拟器上运行良好(用 Debug-iphonesimulator 替换 Debug-iphoneos,在这种情况下它也会忽略 -w),但是如果我使用为设备编译的应用程序启动它会崩溃(我尝试使用发布和调试,我得到相同的结果)。

我得到的错误是:

posix 生成失败;中止启动(二进制 == /Users/X/Library/Developer/Xcode/DerivedData/TestiPhoneAutomation2-dyufpxsavtdqkybpagcoawdudzid/Build/Products/Debug-iphoneos/TestiPhoneAutomation2.app/TestiPhoneAutomation2)。 2012-10-03 12:10:36.609 仪器[76151:1603] 录音取消: 至少有一个目标发射失败;中止运行仪器跟踪 错误:启动跟踪失败。

【问题讨论】:

    标签: ios xcode automation instruments ios-ui-automation


    【解决方案1】:

    请检查命令行中 UDID 的顺序,实际上所有参数也仅在调试版本的构建中运行。希望这行得通,因为它对我有用。

    【讨论】:

    • 你能给我一个你使用的命令行的例子吗?
    【解决方案2】:

    对于遇到此问题的其他人,我将解释什么对我有用以及我是如何解决这个问题的。

    我执行了ps 命令来查看哪些进程正在运行。我发现仪器仍在运行。然后我做了killall instruments,这杀死了仪器进程。然后我做了我的仪器命令,然后它就完美地工作了。

    【讨论】:

      【解决方案3】:

      我遇到了同样的错误,但我没有运行多个 Instruments 副本。我通过将 -w UDID 参数放在应用程序之前并仅使用应用程序的名称(应用程序已部署到设备)来实现此功能。

      我使用的命令行如下(使用 Xcode 4.6):

      instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w -e UIASCRIPT -e UIARESULTSPATH

      【讨论】:

      • 谢谢,这工作正常...,我使用相同的命令,但“-w udid”位置不同。把它放在 tracetemplate 之后和 app-name 之前对我来说效果很好
      猜你喜欢
      • 2012-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-22
      • 1970-01-01
      • 2019-05-06
      相关资源
      最近更新 更多