有时候我们需要更快捷的运行 UIAutomation,下面就给大家分享一下在 Command Line 中运行 UIAutomation 的方法
instruments -w deviceID -t defaultTemplateFilePath targetAppName -e UIASCRIPT scriptFilePath -e UIARESULTSPATH resultsFolderPath
各参数释义:
模拟器(在模拟器上运行不需要 UDID,但是需要将 targetAppName 替换成具体的模拟器的沙盒应用程序,在 Xcode5 下模拟器的沙盒应用程序位于 /Users/Your_UserName/Library/Application Support/iPhone Simulator/Simulator_Version/Applications 中)
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate "/Users/kingson/Library/Application Support/iPhone Simulator/7.1/Applications/C28DDC1B-810E-43BD-A0E7-C16A680D8E15/Testapp.app" -e UIASCRIPT /Users/kingson/PycharmProjects/ynm3k/robot4ios/util/logtree.js -e UIARESULTSPATH /Users/kingson/UIAutomationResult
真机
instruments -w ae04ee552548410bad958135304cd519******** -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate Testapp -e UIASCRIPT /Users/kingson/PycharmProjects/ynm3k/robot4ios/util/logtree.js -e UIARESULTSPATH /Users/kingson/UIAutomationResult
模拟器(注意:在 Xcode6 中,模拟器的沙盒应用程序位置变成了 /Users/Your_UserName/Library/Developer/CoreSimulator/Devices/Simulator_UDID/data/Containers/Bundle/Application 中)
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate "/Users/kingson/Library/Developer/CoreSimulator/Devices/E48D90E6-8313-4318-8064-48B16462AD8E/data/Containers/Bundle/Application/35A7348C-059D-42BA-86F4-ADFFD76DC182/Testapp.app" -e UIASCRIPT /Users/kingson/PycharmProjects/ynm3k/robot4ios/util/logtree.js -e UIARESULTSPATH /Users/kingson/UIAutomationResult
真机
instruments -w ae04ee552548410bad958135304cd519******** -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate Testapp -e UIASCRIPT /Users/kingson/PycharmProjects/ynm3k/robot4ios/util/logtree.js -e UIARESULTSPATH /Users/kingson/UIAutomationResult