Mobile App Automation Testing Using Appium
What is Mobile Automation Testing?
Mobile Automation testing provides a mechanism to consistently repeat a test procedure and verify application results. It can be effective both for regression testing as well during development.
Testing mobile applications are different and more complex than testing traditional desktop and web applications.
Pre-Requisites for Mobile Automation Testing on Windows 7:-
Eclipse should be installed
Android SDK and APIs for recent versions of Android
Selenium Web driver knowledge.
Some basic Knowledge of Mobile.
Install and Un-install Application using command Prompt:-
Install an App: – adb install full_path_of_apk adb install C:\Users\Keshav\Downloads\teamchat.apk
Un-Install an App: –adb uninstall package_name_of_apk
adb uninstall com.teamchat
What is Appium?
Appium is an Open source, Cross Platform test automation tool for mobile apps
Supports automation of Native, Hybrid and Mobile Web apps
Based on Client-Server Architecture
Appium Server written in Node.js
What are Desired Capabilities?
Desired Capabilities are a set of keys and values sent to the Appium server to tell the server what kind of automation session we’re interested in starting up.
File appDir=new File(“E:\Softwares\APK\News”);
File app = new File(appDir, “SplashActivity_2.1.22_latlong.apk”);
DesiredCapabilities cap=new DesiredCapabilities();
Mobile Device For Automation using Appium:-
For setting up mobile devices, we have to verify that whether developer options is enable or not.
USB Debugging is allowed or not.
For Real device, Android version must be 4.2 or above.
Step By Step Installation:-
STEP 1: – Install and Set up JAVA (Help Link)
STEP 2: – Install and Set up Android SDK (Help Link)
STEP 3: – Restart the system (Strongly Recommended)
STEP 4: – Setup Eclipse(Link) and Pin to Task Bar (Right Click on Eclipse.exe and set it to Pin to taskbar)
STEP 5: – Launch Eclipse and create a new project
STEP 6: – Check android is installed on your system or not. Open command prompt –> type adb on command prompt
STEP 7: – Check Connected Device adb devices
STEP 8: – Install Device PC Suite
STEP 9: – Enable Developer Option and allow USB Debugging
Step 10: – After completing all these steps, just type adb devices on cmd prompt
Step 11:- adb install D:\Mobile_Setupapk\teamchat.apk
It will install the application on the connected device with a Success message.
Step 12: – Download Appium Link
Step 13: – Install Appium and click on Appium.exe
Step 14: – Launch Appium
Step 15: – Setup is complete and now we have to start the Mobile Automation:-
Attach your Mobile Device with your system using adb devices command and verify that device is attached to the system.
Start Eclipse and create a new program for mobile device automation.
After launching Appium Run the Script.
Step 16: – Launch UI Automator (Available at D:\SDK\tools location)
It will help us to find out the mobile objects.
How UI Automator works:-
Connect the device.
Launch the desired app
Launch UI Automator(/SDK/tools/UI Automator)
Click on Green Colored Icon Below and move the cursor to the desired object and Select the Object Properties.
Step 17: – Object locators: – We have prioritized the list of locators to be used when scripting. Id, Name, Link text, Partial Link text, Tag Name, class name, CSS, XPath
Step 18: – How to get .apk file properties:- aapt.exe dump badging apk file path
Step 19: – Required JAR’s
Import Selenium Stand Alone Server Jar (selenium-server-standalone-2.53.0) and Java-client.Jar 3.3.0