facebook twitter hatena line google mixi email

テストツール/appium/インストール

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

appiumとは

android,xcode用のテストツール

appiumインストール準備

javascript/nodejs/インストール/nvm [ショートカット]

javascript/nodejs/npmインストール [ショートカット]

$ node -v
v10.9.0
$ npm -v
6.2.0

java,androidのパスをbash_profileに追加

自分はこんな感じでした。 vi ~/.bash_profile

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export ANDROID_NDK_HOME=/Users/[user1]/Library/Android/android-ndk-r13b
export ANDROID_HOME=/Users/[user1]/Library/Android/sdk
alias adb=/Users/[user1]/Library/Android/sdk/platform-tools/adb

appiumインストール

$ npm install -g appium --unsafe-perm=true --allow-root
$ appium -v
1.9.0

Error: EACCES: permission denied, mkdirエラー対応

以下エラーが出た場合

Error: EACCES: permission denied, mkdir '/Users/[user1]/.nvm/versions/node/v10.9.0/lib/node_modules/appium/node_modules/appium-chromedriver/2018729-87385-1e4d67d.0k27'
$ sudo npm install -g appium

ではなく以下でインストール

$ sudo npm install -g appium --unsafe-perm=true --allow-root

参考:https://github.com/appium/appium/issues/10020

appiumインストールチェック

$ npm install -g appium-doctor
$ appium-doctor
info AppiumDoctor Appium Doctor v.1.4.3
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /Users/[user]/.nvm/versions/node/v10.9.0/bin/node
info AppiumDoctor  ✔ Node version is 10.9.0
info AppiumDoctor  ✔ Xcode is installed at: /Library/Developer/CommandLineTools
info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor  ✔ HOME is set to: /Users/[user]
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/[user]/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
info AppiumDoctor  ✔ adb exists at: /Users/[user]/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: /Users/[user]/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: /Users/[user]/Library/Android/sdk/tools/emulator
info AppiumDoctor  ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!

Bin directory for $JAVA_HOME is not setエラーが出たら

PATHにJAVA_HOMEを追加する

vi ~/.bash_profile

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export PATH=${JAVA_HOME}/bin:$PATH

$ source ~/.bash_profile

Carthage was NOT found!エラーが出たら

$ brew install carthage

コマンドでの起動

$ appium &
[1] 21538

こんな感じで起動する

[Appium] Welcome to Appium v1.9.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723

コマンドでの終了

$ ps ax | grep appium
94867   ??  S      0:03.17 node /Users/masahiko-kajimura/.nvm/versions/node/v10.9.0/bin/appium
$ kill 94867