2015年2月4日 星期三

Appium 安裝及Tutorial Project 執行 - Linux + Android


Reference: How to setup Appium in Ubuntu for android
Install Appium
Do not install nodejs through apt-get, which will need sudo rights and appium will not work if node is installed as sudo user. If you have already installed remove it using
   $ sudo apt-get remove nodejs
   $ sudo apt-get remove npm

Download latest nodejs linux binaries form http://nodejs.org/download/
Extract into a folder that doesn't need sudo rights to access, for example your home folder.
   $ tar -xvf

Add the following line to your ~/.bashrc file.
   $ export PATH=$PATH:[full_path_of_the_extracted_node_folder]/bin

Open a now terminal and do
   $ npm install -g appium
   (or) 
   $ sudo /home/sqa/appium_env/node-v0.10.35-linux-x64/bin/npm install -g appium
   $ appium

Instal maven

For run appium test script
   $ sudo apt-get install maven

 Set environment variables

Add the following line to your ~/.bashrc file.
   export JAVA_HOME=/usr/lib/jvm/java-7-oracle
   export ANDROID_HOME=/home/jocelynyang/android-studio/sdk

----------------------------------------------------

Run appium tutorial project 

Path of demo project: appium\tutorial\projects\java_android
Start appium, eg:
   $ appium
To compile and run all tests, run:
   $ mvn clean test
To run a single test, run
   $ mvn -Dtest=appium.tutorial.AutomatingASimpleActionTest test

----------------------------------------------------

Issue

[Error message]
$ mvn --version
Error: JAVA_HOME is not defined correctly.
  We cannot execute /usr/lib/jvm/java-7-openjdk-amd64/bin/java

設定好 java 環境變數: export JAVA_HOME=
  $ export JAVA_HOME=/usr/lib/jvm/java-7-oracle

[Error message from appium server]
info: [debug] Starting logcat capture
error: Logcat capture failed: spawn ENOENT

設定好 android 環境變數: ANDROID_HOME=
  $ export ANDROID_HOME=/home/jocelynyang/android-studio/sdk

沒有留言:

張貼留言