If you are new to appium, please refer below links for the prerequisites
- Eclipse IDE setup
- Appium setup for windows [Mandatory to have the setup before proceeding]
- How to find appium locators
- App Package and activity name
For the appium test: we will be using Selenium, Appium, Eclipse IDE (java) and Android app (.apk) in an emulator or real handset…
Before running appium test on real device or android emulator, make sure we keep the device connected to computer, use adb command to verify.
Ways to install apps (.apk) on mobile or emulators:
- Install as usual from android play store.
- Using command line
Have the required .apk file on computer, and connect mobile to computer in debug mode.
open command prompt, type
adb install [apk file path]
For appium test, we will use selendroid sample application… [download selendroid-test-app.apk ‘click on view raw to download’]
Required jar files :
- selenium related jar files [follow webdriver setup to download]
Let’s understand the above code in details:
Code uses testNG, Java and appium…
We have capabilities setup for the mobile handset or emulator like DeviceName, Platform, version, app activity, app package etc…
Refer Appium capabilities for more information
then, we have instantiated AndroidDriver object which accepts 2 arguments:
- Capability object
Under @Test, whatever the code present is same as selenium test.