我关注了这个网站,开始学习UI自动化。http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation#1.2
我正在尝试从命令行启动Instruments。不幸的是,我得到了一个错误:
2013-03-14 14:06:36.376 instruments[17854:1207] Connection to the remote device lost while launching target. Aborting...
2013-03-14 14:06:36.378 instruments[17854:1207] Recording cancelled : At least one target failed to launch; aborting run
Instruments Trace Error : Failed to start trace.这是我使用的命令:
instruments -w {deviceId} -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate {appname} -e UIASCRIPT /Path/to/Script.js
目前我使用的是Xcode4.6。
发布于 2014-09-21 06:34:27
在2014年的Xcode6.0.1中,您可以这样做来在模拟器上运行UIAutomation测试,以-w开关命名您的模拟器:
instruments -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
-w 'iPhone 5s' \
'/Users/sohail/Library/Developer/CoreSimulator/Devices/7232A640-A9D2-4626-A2AD-37AFFF706718/data/Containers/Bundle/Application/E71B915E-051D-4BEF-9083-34416D02EC91/RoadRunnerRadar.app' \
-e UIASCRIPT '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestRunner.js' \
-e UIARESULTSPATH '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestResults/'如果你想在你的设备上运行它,而不是像我在上面的代码片段中那样在模拟器上运行的‘UDID5s’,你应该提供你设备的iPhone。然后,您可以省略我上面给出的长应用程序路径,只需提供应用程序的名称。仪器将能够在设备上找到它。
使用上面的示例,但针对假设设备进行了修改,如下所示:
instruments -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
-w '8532A640-A9C2-4626-A2AD-37AFFF706799' \
'RoadRunnerRadar' \
-e UIASCRIPT '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestRunner.js' \
-e UIARESULTSPATH '/Users/sohail/Developer/clients/acme/roadrunnerradar/ACMERoadRunnerRadarAutomationTests/TestResults/'这不能通过设备上的调用进行验证,因此请测试它。参数排序有一定的灵活性。
我确实有一个经过验证的UI Automation Runner脚本,它可以很好地用于Xcode6.0.1和模拟器。
发布于 2013-03-24 04:44:29
我建议你看看乔纳森的屏幕截图,他在http://cocoamanifest.net/articles/2013/01/ui-screen-shooter.html上解释了这一点。这真的帮助我了解了很多关于模拟器的知识,从命令行运行仪器等等。就像Jonathan解释的那样,你需要首先构建应用程序,然后才能运行一些东西。
在这里获取他的资源:https://github.com/jonathanpenn/ui-screen-shooter,看看这对你是否有效。然后返回一个简单的脚本,该脚本将构建应用程序,将其放在一个方便的位置,并使用应用程序和所需的模板运行仪器。
发布于 2013-06-14 01:23:27
这对我很有效。
我执行了ps命令来查看哪些进程正在运行。我发现仪器还在运转。然后我做了killall instruments,这杀死了仪器进程。然后我做了我的仪器命令,它在那之后工作得很好。
https://stackoverflow.com/questions/15410465
复制相似问题