1.安裝
#cnpm i -g macaca-cli macaca-ios# Install Tools And Driver
2.檢查安裝環境
#macaca doctor
![](http://static.javashuo.com/static/loading.gif)
ANT_HOME未設置,下載ant:
http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.7-bin.zip
解壓到C盤,並設置ANT_HOME
從新打開cmd窗口,再次檢查全部項目都OK。
3.下載一個官方示例:
https://github.com/macacajs/macaca-test-sample
解壓到你的macaca用例目錄(自定義)
$cdmacaca-test-sample$npm i$macaca run --verbose
運行報不少錯誤,其中最前面有以下內容:
C:\Users\Tony\macaca\macaca-test-sample-master>macaca run
>> webdriver sdk launched
>>
>>
macaca desktop sample
>> please run: `npm install macaca-electron -g`
TypeError: Cannot set property 'proxyMode' of undefined
at Object.createDevice (C:\Users\Tony\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\.1.0.68@web
driver-server\lib\server\controllers\session.js:16:20)
at next (native)
at onFulfilled (C:\Users\Tony\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\.4.6.0@co\index.js:
65:19)
at C:\Users\Tony\AppData\Roaming\npm\node_modules\macaca-cli\node_modules\.4.6.0@co\index.js:54:5
按照提示執行:
#npm install macaca-electron -g
而後再次執行:macaca run可看到以下窗口在自動運行腳本:
CMD窗口可看到以下信息:
可見桌面用例執行成功,mobile相關用例還不行,看日誌內容是找不到IOS的SDK,咱們只安裝了android固然是沒用ios相關SDK的。
4.修改腳本里的IOS爲Android
修改文件後綴名,註釋掉其餘兩個腳本,只保留macaca-mobile-sample.test.js
![](http://static.javashuo.com/static/loading.gif)
按照要求執行:
#npm install macaca-android -g
再次執行macaca,報錯
no device, now create one from avd
Error: no avd created! Please create one avd first
說明沒有安裝android虛擬機
未完待續。。。。