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和模擬器非常有效。