如何获得UIAutomation,Simulator和Xcode调试器同时运行? [英] How to get UIAutomation, Simulator, and Xcode Debugger Running at the same time?

查看:134
本文介绍了如何获得UIAutomation,Simulator和Xcode调试器同时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



约束条件:$ b可以指向我有关如何让Instruments运行UIAutomation脚本并启动iPhone应用程序的文档? $ b我只有iPhone 3g硬件才能使用UIAutomation进行测试和设备调试,但无法正常工作。
正常情况下,测试脚本只是运行以确保一切都通过,但现在存在一个奇怪的错误,只有在UIAutomation脚本运行时才会触发(这是一件好事)。该错误不能在手动操作中复制。
似乎无法将Instruments UIAutomation附加到已在仿真器中运行的进程。没有选择。
启动仪器UIAutomation直接不会导致它启动调试器。



我会假定有一些命令行魔术可以在乐器中编辑edit主动目标(环境变量,参数,工作目录),以实现这一点,但我还没有找到魔术段。



谢谢,
Neil <这也使我陷入了一段时间 - 特别是自从选择自动化仪器后,Instruments应用程序明确地说<$ c $ c>当前工具不允许附加。关键是要认识到,在模拟器中运行的应用程序作为其自己的进程在主机系统中可见,因此直接从GDB进行连接运行良好。这些说明适用于Snow Leopard 10.6.8上的XCode 4.2(4C199):


  1. 在乐器中开始测试, (直接从Instruments或Xcode 4的 Product - > Profile )。选择任何模板和脚本以使您的自动化测试正在进行中。

  2. $回到Xcode,在菜单产品 - >附加到进程下,您应该看到您的iOS应用程序(按名称列出)以及所有其他应用程序在您的主机上,实际上,它很可能会首先列在节标题可能目标中。

    $ b $如果它不可见,请选择视图 - >调试区域 - >显示调试区域,以便您可以看到gdb控制台。

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

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


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

解决方案

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.

这篇关于如何获得UIAutomation,Simulator和Xcode调试器同时运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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