来自命令行的 iOS UI自动化
我对它的工作原理理解有问题。我想在设备上运行测试,所以我有命令
instruments -w [...] -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/lazarenok/Default/Shasta/iOS/Shasta/Shasta.xcodeproj -e UIASCRIPT /Users/lazarenok/Desktop/SignInAndOut.js -e UIARESULTSPATH /Users/lazarenok/Desktop/1
所以,[...]
- 是设备 ID,/Users/lazarenok/Default/Shasta/iOS/ Shasta/Shasta.xcodeproj
- 应用程序路径。
但我想应该不是这样的吧?如何找到我的应用程序的路径,例如 .app
?还是我的路是对的? UIARESULTSPATH 应该是什么?结果保存在哪里?
I have a problem with understanding of how it works. I want to run my test on the device, so I have the commands
instruments -w [...] -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/lazarenok/Default/Shasta/iOS/Shasta/Shasta.xcodeproj -e UIASCRIPT /Users/lazarenok/Desktop/SignInAndOut.js -e UIARESULTSPATH /Users/lazarenok/Desktop/1
So, the [...]
- is the device id, /Users/lazarenok/Default/Shasta/iOS/Shasta/Shasta.xcodeproj
- application path.
But I guess it should be not like this? How can I find the path for my app like .app
? Or is my path right? And what should be the UIARESULTSPATH? Where are the results saved?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于应用程序的路径,您使用了 .xcodeproj 文件的路径。情况不应该如此。相反,您应该使用 .app 文件的路径。 .app 文件通常由 xcode 在使用 xcode 构建应用程序时创建。要找到此内容,请转到:
/Users//Library/Application Support/iPhone Simulator
然后转到与您所使用的模拟器版本对应的文件夹,然后转到
Applications
。在这里您会发现一些名称神秘的文件夹。每个文件夹都对应于您在模拟器中安装的应用程序。选择与您要自动化的应用程序相对应的文件,您将在其中找到.app
文件。至于 UIARESULTSPATH,这可以是您要保存测试结果的任何文件夹的路径。
For the path to the application you used the path to your .xcodeproj file. This shouldn't be the case. Instead you should use the path to your .app file. A .app file is usually created by xcode upon building your application using xcode. To find this go to:
/Users/<username_with_which_you_are_currently_logged_in>/Library/Application Support/iPhone Simulator
Then go to the folder corresponding to the version of the simulator you are using and then go to
Applications
. Here you will find some folders with cryptic names. Each of these folders correspond to the applications that you have installed in your simulator. Select the one corresponding to the application you are automating and inside you will find.app
file.As for the UIARESULTSPATH, this can be the path to any folder where you want to save the results of your test.
在 2014 年使用 Xcode 6.0.1 时,您将为模拟器执行类似的操作,在 -w 开关后命名您的模拟器:
如果您想在您的设备上运行它,而不是像我在上面的代码片段中那样运行“iPhone 5s”要在模拟器上运行,您需要提供设备的 UDID。然后,您可以省略我上面给出的长应用程序路径,而只提供应用程序的名称。仪器将能够在设备上找到它。
使用上面的示例,但针对假设的设备进行了修改,这看起来像:
这没有通过设备上调用进行验证,因此请对其进行测试。参数排序有一定的灵活性。
我确实有一个经过验证的 UI Automation Runner 脚本非常适合 Xcode 6.0.1 和模拟器。
In 2014 with Xcode 6.0.1, you would do something like this for the simulator, naming your simulator after the -w switch:
If you want to run this on your device, instead of 'iPhone 5s' like I have in the snippet above for running on the simulator, you'd provide the UDID of your device. You can then omit the long app path I've given above, and just provide the name of the app. Instruments will be able to find it on the device.
Using my example from above, but modified for a hypothetical device, this would look like:
This is not verified with an on device invocation, so please test it. There's a bit of flexibility with parameter ordering.
I do have a verified UI Automation Runner script that works really well for Xcode 6.0.1 and the simulator.