Setting up Appium mobile app testing on a real device to test Real App
**** At the end you will find my elaborated youtube video on this topic ***
Appium as a mobile app test tool which is easy to use but then most challenging part of Appium is to do the configuration setup. So here are the most important steps that you need to perform in order to use Appium in your test framework.
Step 1: You need to have Java, Maven setup in your machine that you have want to script and run Appium Tests (pre-requisite).
make sure you have configured the JAVA_HOME and MAVEN_HOME in your environment system variables
The below command helps to check java and maven in your machine
> java -version
> mvn -version
Step 2: You need node installed in your machine
The below command helps to check node in your machine
node -v
If node is not in the machine you can follow the steps:
https://nodejs.org/en/download
Step 3: Install Appium in the machine
The below command helps to install Appium server in your machine using node
node appium
the below short command helps to start the Appium server
appium
Step 4: About the Android phone and how to connect to your machine order to use the real android device to you machine — Connect the phone via USB cable, post connecting the phone you need to do below steps:
Go to the Android phone settings > About phone > Click on version 7 times and the phone should get converted into Developer options
now go to Developer options- if you are not able to see that option follow the below path.
After the above is done go to Android phone settings > Additional settings > Developer options > USB debugging (Enable)
Post these steps please run the below command to verify your android mobile is really connected or not
adb devices
now incase you are getting an error, most probably that's because either your phone is not in USB debugging mode or you don't have platform tools in environment variables
Try reconnecting your phone as well
Step 5: About capabilities of mobile app that you are testing
Understanding capabilities are the most important part of the appium as it needs to know which device, which OS, which mobile app etc needs to be launched to test. The below set up capabilities will give you an idea about the capabilities
cap.setCapability("deviceName","OPPO Find X3 Pro");
cap.setCapability("udid","4d897317");
cap.setCapability("platformName","Android");
cap.setCapability("platformVersion","11");
cap.setCapability("automationName","uiAutomator2");
cap.setCapability("appPackage","com.ubercab");
cap.setCapability("appActivity","com.ubercab.presidio.app.core.root.RootActivity");
in the above set of capabilities it helps Appium code to understand that which device, which OS, which OS platformversion, which driver, which app, which activity needs to be launched to start Appium tests.
Step 6: Install Appium driver in your machine
Appium needs one of the Appium drivers to be installed and present prior to running the test. So in this case as we are using Android mobile app we need to use ‘UiAutomator2’ as our Appium driver. Now if you are still doubtful on which Appium driver to use then kindly have a look at the official Appium driver documentation
Step 7: Installation of android sdk platform tools
Android sdk platform tools needs to be downloaded and installed.
https://developer.android.com/tools/releases/platform-tools
post installation — the environment path needs to be setup for the ANDROID_HOME
Step 8: Setting up ANDROID_HOME in environment variables
post installation in above step the environment system variables the ANDROID_HOME needs to be setup
Step 9: Install Appium inspector to inspect the elements on the mobile app
Appium inspector is a tool used to provide you the best possible selectors which can help you in Appium tests.
Step 10: Launching mobile application using Appium
After writing the simple steps of launching the mobile app and then using the Appium driver steps to navigate on the app and validating, you will be able to successfully run the Appium tests
detailed tutorial has been uploaded in the below youtube link:
Thanks for reading !
We are team of passionate techies — who help to share knowledge within our community — if you like our content — kindly follow, share and subscribe.