1

我有一个理解它是如何工作的问题。我想在设备上运行我的测试,所以我有命令iOS UIAutomation从命令行

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?结果保存在哪里?

回答

0

对于应用程序的路径,您使用了.xcodeproj文件的路径。这不应该是这样。相反,你应该使用你的.app文件的路径。 .app文件通常由xcode在使用xcode构建应用程序时创建。要找到它,请转到:/Users/<username_with_which_you_are_currently_logged_in>/Library/Application Support/iPhone Simulator 然后转到与您正在使用的模拟器版本对应的文件夹,然后转到Applications。在这里你会发现一些具有神秘名字的文件夹。这些文件夹中的每一个都与您在模拟器中安装的应用程序相对应。选择一个对应于你自动化的应用程序的对象,你会发现.app文件。

至于UIARESULTSPATH,这可以是要保存测试结果的任何文件夹的路径。

0

2014年和Xcode 6.0.1,你会做这样的事情的模拟器,-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/' 

如果您想您的设备上运行它,而不是'iPhone 5s'就像我上面的代码片段在模拟器上运行一样,你会提供你设备的UDID。然后,您可以省略上面给出的漫长应用程序路径,并提供应用程序的名称。仪器将能够在设备上找到它。

用我上面的例子,但被修改为一个虚构的设备,这将是这样的:

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脚本,它对Xcode 6.0.1和模拟器非常有效。