Instruments-Automation: 通過命令行運行測試用例

    爲了實現自動定時的運行腳本,我們需要在命令行運行和啓動腳本,具體代碼如下:

instruments -t 
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
<full_path_to_application> 
-e UIASCRIPT <path_to_script.js>
-e UIARESULTSPATH <output_results_path>


1.  -t 後面的參數爲 Automation.tracetemplate 的路徑,每個版本的位置都有所不同,在命令行下使用 instruments -s 命令進行查詢。
2.  full_path_to_application 是你的的被測應用的完整目錄,需要在前後加上雙引號。
3.  -e UIASCRIPT  指定執行的 js 腳本存放的位置,需要在前後加上雙引號。
4.  -e UIARESULTPATH  指定輸出結果存放的路徑,需要在前後加上雙引號。

5. 如果需要在真機運行,在-t 參數前加上  -w UDID, 其中UDID爲被連接手機的設備標識(可通過iTools查看)。


舉例在我本地模擬器上的腳本如下:

instruments -t 
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate 
"/Users/wangxinxin/Library/Developer/Xcode/DerivedData/TestAutomation-ahmqgmqipyidexemazbprqxqkrya/Build/Products/Debug-iphonesimulator/TestAutomation.app" 
-e UIASCRIPT "/Users/wangxinxin/Documents/TestAutomation/test.js" 
-e UIARESULTSPATH "/Users/wangxinxin/Documents/TestAutomation"


發佈了39 篇原創文章 · 獲贊 10 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章