如何让 UIAutomation、模拟器和 Xcode 调试器同时运行?

发布于 2024-10-08 07:05:46 字数 407 浏览 4 评论 0原文

谁能向我指出有关如何使 Instruments 运行 UIAutomation 脚本并使用在模拟器中运行的调试器启动 iPhone 应用程序的文档?

限制条件: 我只有 iPhone 3g 硬件来测试和调试,而 UIAutomation 无法可靠地工作。 通常,测试脚本只是运行以确保一切都通过,但现在存在一个奇怪的错误,只有在 UIAutomation 脚本运行时才会触发(这是一件好事)。手动操作无法重现该错误。 无论如何,似乎没有办法将 Instruments UIAutomation 附加到模拟器中已运行的进程。没有选择。 直接启动 Instruments UIAutomation 不会导致它与调试器一起启动。

我假设可以在仪器编辑活动目标(环境变量、参数、工作目录)中配置一些命令行魔术来实现这一点,但我还没有找到魔术段落。

谢谢, 尼尔

Can anyone point me to the documentation on how to make Instruments run UIAutomation scripts and start the iPhone application with the debugger running in the Simulator?

Constraints:
I only have iPhone 3g hardware to test with and debugging against the device with UIAutomation just does not reliably work.
Normally the test scripts are just ran to make sure everything passes, but now a weird bug exists that only gets triggered when the UIAutomation script runs (which is a good thing). The bug cannot be duplicated in manual operation.
There does not seem to be anyway to attach Instruments UIAutomation to a process already running in the simulator. There is no selection.
Starting Instruments UIAutomation directly does not cause it to start with the debugger.

I would assume that there is some command line magic that can be configured in Instruments edit active target (environment variable, arguments, working directory) to make this happen, but I've not found the magic paragraph.

Thanks,
Neil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓦然回首 2024-10-15 07:05:46

这也让我困惑了一段时间——特别是当选择自动化仪器时,仪器应用程序明确表示当前仪器不允许附加。关键是要认识到在模拟器中运行的应用程序在主机系统中作为其自己的进程可见,因此直接从 GDB 附加效果很好。这些说明适用于 Snow Leopard 10.6.8 上的 Xcode 4.2 (4C199):

  1. 按照通常的方式在 Instruments 中开始测试(直接从 Instruments 或从 Xcode 4 的 Product -> Profile选择任何模板和脚本来开始自动化测试。

  2. 返回 Xcode,在菜单 Product -> Attach to Process 下,您应该会看到按名称列出的 iOS 应用程序以及所有的 事实上,它很可能会首先在可能的目标部分标题下列出。

  3. 如果不可见,请选择查看 ->调试区->显示调试区域,以便您可以看到 gdb 控制台。

  4. 点击暂停按钮(产品 -> 调试 -> 暂停)来中断程序。像往常一样设置断点、检查。

那么下一个问题是:为什么我在调试器控制台中看不到正常的 NSLog() 输出?
您的应用程序已将自身绑定到控制台输出流,因此查找其输出的最简单位置是在 OS X 控制台应用程序 (/Applications/Utilities/Console.app) 中,并在 DATABASE 下查找搜索 ->所有消息

This stumped me for a while, too -- especially since when the Automation Instrument is selected, the Instruments application explicitly says Current instrumentation disallows attach. The key is to realize that an app running in the simulator is visible in your host system as its own process, so attaching directly from GDB works well. These instructions are for XCode 4.2 (4C199) on Snow Leopard 10.6.8:

  1. Start your test in Instruments however you normally do (either directly from Instruments, or from Xcode 4's Product -> Profile. Pick whatever templates and scripts to get your automated test underway.

  2. Back in Xcode, under the menu Product -> Attach to Process, you should see your iOS app, listed by name, alongside all the other applications on your host computer. In fact, it very likely will be listed first, under the section header Likely Targets.

  3. If it's not visible, choose View -> Debug Area -> Show Debug Area so you can see the gdb console.

  4. Hit the pause button (Product -> Debug -> Pause) to interrupt your program. Set breakpoints, inspect, as usual.

Then next question is: why can't I see my normal NSLog() output in the debugger console?
Your app already bound itself to the console output streams, so the simplest place to look for its output is in OS X Console app (/Applications/Utilities/Console.app) and look under DATABASE SEARCHES -> All Messages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文