I have started working on mobile test automation and had to do lot of research. I found it really difficult to get resources on BDD (Behavior Driven Development), Cucumber, Appium setup. After slogging for a month and documenting everything I did, I was finally able to start doing automation. I believe other testers could be suffering like me, so here are step by step instructions to set up Appium+Cucumber+Java. Enjoy and let me know in case of any questions
Example: In the below image there are many files in that select AppiumForWindows_1_4_16_1.zip file because that is the latest version released by Appium till date, if any other version is released it will be above this file and we would download that one.
This page gives step by step instructions to set up your Mac/Windows machine with Cucumber+Jave+Appium framework.
Thank you for downloading Appium from our software portal. The version of the program you are about to download is 1.4.16.1. The download was scanned for viruses by our system. Appium 1.9.0 Free Download for Windows. Appium 1.9.0 Free Download for Windows – Appium is an open source examination automation framework for use with indigenous, hybrid and mobile internet applications.Indigenous apps are those written making use of the iphone, Android, or Windows SDKs. Thank you for downloading Appium for Mac from our software library. You are downloading Appium for Mac, version 1.5.3. Each download we provide is subject to. Appium 1.9.0 Free Download for Windows. Appium 1.9.0 Free Download for Windows – Appium is an open resource test automation framework for usage with indigenous, hybrid and also mobile internet apps.Indigenous applications are those created using the iOS, Android, or Windows SDKs.
TABLE OF CONTENTS
- Components needed for ATDD Automation
- Installation Instructions Mac and Windows
- Android Specific Instructions
- Steps to Ensure Environment is Setup Correctly for ATDD Automation
- Steps for Manual Installation of Cucumber and Appium JAR files
- Cucumber Learning Resources
COMPONENTS NEEDED FOR ATDD AUTOMATION
The following components need to be installed
- Homebrew
- Node.js
- Appium (command line)
- Appium UI application
- Android Studio (With Android SDK)
- Set up ANDROID_HOME
- Android Emulator
- Java JDK
- Set up JAVA_HOME
- Xcode
INSTALLATION INSTRUCTIONS
Step 1- Install HomeBrew from this link – http://brew.sh/index.html. Copy and paste the command under “Install Homebrew” section in the Terminal/Command Line.
Step 2- Install Node.js and Appium Server.
For Mac Users:
Type the following commands in the Terminal/Command Line.
- brew install node
- npm install -g appium
- npm install wd
For Windows Users:
- Go to https://nodejs.org/en/download/
- Download Node.js
- After installation of Node.js type in the below commands
- npm install -g appium
- npm install wd
Step 3- Install Appium UI application from this link – http://appium.io/downloads.html.Click the Desktop Apps based on Mac/Windows machine. Download and Install appium-1.4.13.dmg file or AppiumForWindows_1_4_16_1.zip based on Mac/PC user.
NOTE: Sometimes you have problems when downloading appium through Chrome. So it is recommended you use Safari or Firefox
For Mac Users:
- Ensure you drag the appium folder to the application folder when asked
- Appium will get copied to the Applications folder
For Windows Users:
- Double click on appium_installer.exe from the Download folder as show below
Step 4- Install Android Studio from this link – http://developer.android.com/sdk/index.html.
For Mac Users:
- Click on “Download Android Studio” link and agree to the license.
- After Download and Installation make sure to drag the Android Studio icon to the Application folder
- Open Android Studio and Click on “I Do not…” option in the window and let packages download. Wait till the download is complete
- Minimize Android Studio and go to Step 5
For Windows Users:
- Open Android Studio and Click on “I Do not…” option in the window and let packages download. Wait till the download is complete
- Minimize Android Studio and go to Step 5
Step 5- Install Java JDK form this link – http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.
- Navigate to “Java SE Development Kit 8u66” and download the necessary file based on Mac/Windows
- Then install it after download by double clicking.
NOTE: Ensure Step 5 is Completed before going to Step 6
Step 6- In Terminal/Command Line type “open .bash_profile“. We do this to set the JAVA_HOME and ANDROID_HOME path. Once the profile opens type paste the following information with the correct path information and save the file.
Appium Server 1.7.1 Download
For Mac Users:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
export ANDROID_HOME=/Users/<YOUR USERNAME>/Library/Android/sdk or Omron bp download for mac.
/Users/<YOUR USERNAME>/Library/android-sdks (Based on where the Android SDK is installed)
To ensure the paths are set correctly, please type close the current terminal. Open a new terminal window and type the following
$JAVA_HOME in the terminal. The above JAVA_HOME path set should be displayed
$ANDROID_HOME in terminal. The above ANDROID_HOME path set should be displayed
NOTE: If you cannot find .bash_profile, you need to create one. You can create one by following the below steps
Go to cd /Users/<Username>
Type touch .bash_profile
Type open -a TextEdit.app .bash_profile
For Windows Users:
Go to Start Menu-> Computer->System Properties->Advanced System Properties
Go to Advanced tab->Environment Variables
Set the JAVA_HOME and ANDROID_HOME Path
Usually JAVA_HOME is set to C:Program FilesJava<your jdk version>
ANDROID_HOME is under C:Users<your username>android-sdk-windows
Step 7- (Not required for training but needed to run automation on iPhone simulator) Install Xcode from this link – https://developer.apple.com/xcode/download/. For windows users please go through this video –
https://www.youtube.com/watch?v=sb8BdYH4esQas we need virtual machine to install Xcode unlike Mac Users.
Step 8-Navigate to the below sections based on your machine.
Android Specific Instructions
- Open an android project in Android Studio. Keep clicking on Next button till the project loads up in the editor.
- First time the project is opened and when asked for a SDK, please point it to JDK1.7 or 1.8 based on what JDK version you have.
- The project will indicate missing libraries and may throw errors. Click on the prompt shown by Android Studio to download them automatically on the top right corner of the screen. If you face problems in this please go to last section in this page “Cucumber and Java JAR files and follow the step by step instructions to ensure libraries are installed correctly.
- Go to Android Studio and open “SDK Manager” and ensure you install all the necessary packages
- Go to Terminal/Command Line. Type in the following
- $ANDROID_HOME and press Enter
- Copy the path
- Type cd <path name from above>
- Type cd tools
- Type ./android avd to open the “Android Virtual Device Manager”.
- In the AVD Manager click the “Device Definitions” tab
- Choose “Nexus 4” and select “Create AVD”
NOTE: You need to select “Google API’s Intel Atom (x86)” in the CPU/ABI: field. If you do not see it in the above screen, then go back to the android SDK manager and make sure the package “Intel x86 Atom_64 System Image” and “Intel x86 Atom System Image is installed
- Click “OK” in the window which pops up
- Click on the newly created device and then press “Start”. The emulator should open up showing the default android home page. This ensure that the emulator is set up correctly
- Turning off locking on the emulator
- Ensure locking is turned off on the android emulator. To turn off locking follow the below steps
- Navigate to Settings-> Security->Screen Lock-> Select “None”
- Ensure locking is turned off on the android emulator. To turn off locking follow the below steps
- Go to Android Studio-> Preferences
- Click on Plugins
- Search for “Cucumber for Java” and you should see it checked in the list. If not install it by checking it.
- Search for “Gherkin” and you should see it checked in the list, If not install it by checking it.
- Click on “Apply” and “OK”
- Now the cucumber and appium framework should be configured with Android Studio. If not ensure you follow the JAR installation steps mentioned in the Cucumber and Appium JAR files section of the Wiki which can be found below
TO ENSURE THE ENVIRONMENT IS SET UP CORRECTLY – (PLEASE READ)
To ensure your laptop set up is correct please do the following-
- Check Step– Ensure Appium is setup correctly
For Mac users:
Open the Terminal and type “appium” you should see some prompts. This ensures appium is set up correctly
For Windows Users:
Open the command prompt and type the below commands –
cd C:Program Files (x86)Appiumnode_modulesappiumbin
node appium
This will launch the appium server and this ensures appium is setup correctly
Manual Installation of Cucumber and Appium JAR
Cucumber and Appium JAR files (Files need to get the Cucumber and appium framework in Android Studio)
When Android Studio is opened, you should have automatically got a prompt to import all the dependencies and files. If that did not work properly please import the JAR files manually into Android Studio (NOTE: Download the Cucumber and Appium related JAR Files and save it in a location) . The steps are provided below
- Click on File-> Project Structure
- Navigate to Platform Settings -> SDKs
- Click on the folder “1.8” and click on the “+” sign as shown below
- Navigate to the location where your downloaded the files and click “OK”
- You should see your new JAR files added in the list
- Then click “OK”
- Go to Android Studio-> Preferences
- Click on Plugins
- Search for “Cucumber for Java” and you should see it checked in the list. If not install it by checking it.
- Search for “Gherkin” and you should see it checked in the list, If not install it by checking it.
- Click on “Apply” and “OK”
- Now the cucumber and appium framework should be configured with Android Studio
CUCUMBER LEARNING RESOURCES
Active9 months ago
Problem I was facing with Appium that I decided myself below. I could not find a way to install required components for Appium without using SUDO. After installing it all with SUDO, then trying to run Appium, I was getting error that Appium and NODE should have been installed without SUDO. Trying to search online for solution took me quite a while since there are almost no tutorials exist online for Appium to run on MAC while developing tests using JAVA. Below is the step by step instruction on how to set up Appium on Mac OS and run a first test from within a Java Class. Just copy and paste commands into Terminal on your Mac and you will set it up. I wish there were more clear step by step tutorials online for Appium. Tutorials written by developers of Appium are so vague, I don't even want to recommend to look for answers on their website.
Igor Vishnevskiy
Igor VishnevskiyIgor Vishnevskiy66122 gold badges66 silver badges1313 bronze badges
6 Answers
Answered by Igor VishnevskiyI have been looking for the answer everywhere on the internet and could not find anything. It took me some time to make this work. I hope this quick guide will help the next engineer to save some time on setting up Appium to run automation on Android devices. Appium will not run if NODE or Appium itself is installed using SUDO and MAC won't let you install neither without using SUDO. There is a workaround though. My steps make it possible to install and setup Appium the right way without need to use SUDO for installation. Everything is tested and it works. Below are the steps. Enjoy!
There could be one problem while setting up Appium using bellow steps. If you face some errors while creating or saving data into certain directories, that is caused by the luck of write permissions set to those directories. What you will need to do is to set CHMOD to 777 to the directories where components of Appium are trying to write while installing and then rerun all steps again.
Step 1:Install JAVA 6. You will need JAVA 6 with Appium. JAVA 6 for Mac OS has to be downloaded from Apple's support page:http://support.apple.com/kb/DL1572
Step 2:In your bash add the following path using following format:
Step 3:Setup Maven (Download and set Bash profile PATH for Maven):
------>This is what your Bash Profile should look like:
Obviously to run tests on Android device, you will need to download Android SDK and add it to your Bash Profile as well. To run tests on iOS devices, you will only need to install XCode, no need to add that to your Bash profile. But Android SDK has to be added.
Step 4:Copy and paste following sequence of commands into your Terminal window and press ENTER. Copy and pasting it all together will work. It will take some time to install NODE, so be patient.
Step 5:After installation from Step 4 is complete, run following command in your Terminal window:
Step 6:Then in your Terminal window execute following command:
Step 7:Then in your Terminal window execute following command:
Step 8:Then in your Terminal window execute following command:
Step 9:Then in your Terminal window execute following command to start the Appium server:
(step 9 will start the server).
Step 10:From the separate terminal Window cd to root directory of your JAVA project in your workspace. (example:
cd /Users/ivishnevskiy/Documents/workspace/ApiumJUnit
)Step 11:Attach your Android device to USB and to your MAC computer.
Step 12:In the same Terminal window from Step 10, run following command to launch the Appium test:
where test.java.com.saucelabs.appium is a package nameandAndroidContactsTest is a class name.
If you still need help setting it up. Let me know. I can help. My LinkedIn:http://www.linkedin.com/pub/igor-vishnevskiy/86/51a/b65/
AFTER SETTING APPIUM UP ON YOUR DEVICE, FOLLOW MY NEXT TUTORIAL TO CREATE IN ECLIPSE AND RUN YOUR FIRST TEST ON THE ACTUAL iOS DEVICE (NOT EMULATOR): How to create in Eclipse and run your Appium test on the iOS device (not emulator) where app is installed prior to the execution of the test script?
Community♦
Igor VishnevskiyIgor Vishnevskiy66122 gold badges66 silver badges1313 bronze badges
I used this post to help me set up Appium on my Mac. I also used other sources to do my installation completely. Here are step by step instructions to upgrade to appium
1.7.x
seamlessly on your Mac OS X.Please make a note of the following details BEFORE you start the upgrade process
- If Appium is not installed on your system previously, please use ONLY the commands related to 'Install' below
- If you face any problem of deleting folder/directories using command line, please go to Finder and delete it
- Once you upgrade to new OS on your Mac machine, App Store and iTunes may open late and work slow for the first time
Step by Step Instructions
- Need to install OS 10.12.x or higher version.
- Need to install Xcode 9.x. Sign in with your developer account (
https://developer.apple.com/download/more/
) and download it OR Download it free from the Mac App store
Note - If you face problems while installing the new version of Xcode then please uninstall the old versions.
- Need to install the Command line tools for Xcode 9.x.
Launch Terminal and enter the below command
- Uninstall HomeBrew
Uninstall Command:
- Install HomeBrew
Install Command:
- Uninstall all instances of Node
- go to
/usr/local/lib
and delete anynode
andnode_modules
- go to
/usr/local/include
and delete anynode
andnode_modules
directoryif you installed withbrew
installnode
, then runbrew uninstall node
in your terminal - check your Home directory for any local or lib or include folders, and delete any
node
ornode_modules
from there. (To reach home directory open Terminal and entercd
) - go to
/usr/local/bin
and delete any node executable
- Install Node
Command:
- Install ideviceinstaller:
Command:
- Uninstall Appium from terminal
Command:
- Install Appium
Command:
- Need to Install supporting tools for Appium 1.7.2
Command:
- For downloading simulators go to
Xcode --> Preferences --> Components
, and download necessary simulators.
-Raj
Twitter: https://twitter.com/epsilon11
RajRaj
Steps that need to follow:
- install xcode
- install xcode command line tool
- install Appium GUI *.dmg file Appium
- Install homebrew (assuming you have ruby installed on your mac, if not install ruby first)
- Install Java (it should come with mac OS)
- Install node and Maven using brew command from terminal
- Install Appium server using node
- npm install –g appium
- appium &
- Authorize your iOS simulator and device to access by Appium by typing the command from terminal: sudo authorize_ios
:)
I have made a video about how to configure appium on a Mac computer which can be viewed here.
And slides can be viewed here.
Reaz PatwaryReaz Patwary51522 gold badges55 silver badges2121 bronze badges
Follow these steps.
Pre-requisites to download.1. Appium2. Android SDK3. Java JDK4. Android .apk file5. Xcode and command line tools
Process:
- Install Xcode with command line tools and appium.
- Download all the Android SDK necessary tools, that includes mandatorily platform-tools and build-tools
- Download and install Java JDK
Setting $Path and Configuring
- Open bash_profile with the command
open .bash_profile
- Copy the contents to your .bash_profile
Copy the above, and save the
.bash_profile
- Go to Appium, and click on Android symbol. Select and choose the .apk(place the apk in the project folder)
- Tick on the Device name and choose the applicable Android version in the capabilities.
- In the Advance settings under Android, choose the sdk path(Copy from the android sdk manager)
- Click on the settings symbol, and add value to the
environment variables
- Connect the device or launch the emulator, and click on
Launch
in appium, then click onInspector
, this should create a session and launch the app in your mobile and grab the current screenshot.
EmjeyEmjey
Sorry its a little messy take it from my notes ;
consider you have a system enviroment its located in .bash_profileyou have to add jre jdk files there
also android sdk if you want to run appium for android and ios from mac
there is a ui automator you have to install it
there is a setup dr in appium you can check to see if you install appium correctly
its the steps i take to run appium on ios for [android device and ios device] ;i note every step some step might be un necessaryi wish it help you
go to terminal :
download android bundle for iOS then run command
Open and edit .bash_profile file
open -e .bash_profileIf you don’t have .bash_profile file in your computer path, then create one. Enter below command to create a new file. Once created follow Step-2.
touch .bash_profileStep-3
add and save and again run in terminal
export ANDROID_HOME=/Applications/Appium/Tools/android-sdk-macosx/ export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools step 4 set java home export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
and add it to bash profile
install Eclipse :install test ng in eclipse
add selenium library add maven New java project udid >>find udi in xcode install app in simulatordefaults write com.apple.Finder AppleShowAllFiles TRUEgo to finder
add selenium library add maven New java project udid >>find udi in xcode install app in simulatordefaults write com.apple.Finder AppleShowAllFiles TRUEgo to finder
enable ui automator in XCODE Device
setting >>developer
setting >>developer
install brew ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
install idevicebrew install ideviceinstaller
add maven jar files
update java to 1.8 install java then run this in terminal
preference eclipse java select search add newest version
Rick82611 gold badge1515 silver badges2424 bronze badges
M_ FaM_ Fa3,08211 gold badge1010 silver badges1111 bronze badges
Here is the step by step installation of appium on mac via terminal. After where you can run your java class file with the appium server start from script.
Installation of Appium in MAC
Step 1 : Install java JDK:
-- > Download Link here : http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Step 2 : Install Android Studio:
--> Download Link here: https://developer.android.com/studio/index.html
Scroll till last and find the software as below:
android-studio-ide-173.4819257-mac.dmg
Step 3 : Install Home brew
--> In Terminal install brew:
Step 4 : Install Node.js
--> install node.js:
download installer: https://nodejs.org/en/download/ and run
Step 5 : Install npm
--> In Terminal install npm:
Step 6 : To setup Environment
To open bash_profile in terminal, type the following command:
If bash profile not available, create a bash_profile by following command
Start up Terminal
Type 'cd ~/' to go to your home folder
Type '
touch .bash_profile
' to create your new file.To Edit .bash_profile where you can just type '
open -e .bash_profile
' to open it in TextEdit.paste following:
save (Ctrl+S) and exit
NOTE : As default Android studio and Java takes the above path, if you have changed the path then do change it here with correct version
Step 7. Install AppiumIn Terminal install Appium command line:
Step 8. Install Carthage
Now type the following command to get into WebDriverAgent and Install carthage:
Step 9. Run Appium in command line
From above steps do 'cd' to get out of all subfolders and then type 'appium'
If everything works correct you should get the following line
Now you have to run java class file from the script where have to start the appium server from script, here are the steps to follow
In terminal get the path
Copy the path and note down
- Now open your Run configuration (Eclipse)
- Select the class file you are going to run
- Click on Environment Tab
- Click New
- Give the variable name as 'PATH'
- Now paste the copied path in value and save it
Here is the image link for reference
Now you ran the script and you could see the appium server start in editor console and app will get launch in the device and your script will run
NOTE : For real device iOS automation, you can use appium desktop GUI and some stuff are additionally yet to install for real device iOS automation do the following link for configuration
Post author and executed by https://www.linkedin.com/in/shiv-shankar-siddarth/
Shiv Shankar BalajiShiv Shankar Balaji