Mobile Testing Appium Framework - Mobile Testing

What is appium framework?

Appium is an open-source test automation framework used for testing native and hybrid apps and mobile web apps. It uses WebDriver protocol to drive iOS and Android apps.

Advantages of Appium

  • Appium free and an open source framework.
  • Appium has a very well supported and active Google group.
  • Appium in Selenium 3 spec therefore it is future proof.
  • Appium supports both Android and iOS.
  • Appium does not require anything to be installed on the device – no server or code changes required.

Drawbacks of Appium

  • Does not support intelligent waits.
  • On iOS, user can only execute one test at a time per Mac.
  • Limited support for gestures.
  • Limited support for Android < 4.1

How to Use Appium

Step 1 − Prerequisites to use Appium is Java SDK (minimum 1.6). First install Java on your system by following below steps.

  • Download JDK and JRE from Oracle JavaSE
  • Accept license agreement.
  • Install JDK and JRE.
  • Set environment variable as shown in the screenshot below.

environment variable

Step 2 − Download Android Studio from SDK.

  • Double click the exe and run the installer.
  • Continue with all default options.
  • Set the ANDROID_HOME.

Step 3 − Install Android images and tools.

  • Click on SDK Manager

sdk

  • Select the necessary package. For example, if we are building an App for Android 4.4.2, then make sure below packages are checked under the Tools section
  • Android SDK Tools rev 22.6.3
  • Android Platform-tools rev 19.0.1
  • Android SDK Build-tools rev 19.1

Step 4 − Create Android Virtual Devices

  • Open Android Studio and click AVD Manager in the toolbar. It allows to test and run our Android apps.

avd

  • Use below settings for a Nexus5 AVD
  • Device: Nexus 5 (4.95, 1080 x 1920; xxhdpi)
  • Target: Google APIs x86 (Google Inc.) - API Level 19
  • Make sure you select the target with Google APIs in the name.
  • CPU: Intel Atom (x86)
  • Check the box for Use Host GPU
  • Click OK.
  • Now the AVD you created in the AVD Manager will be shown, where you can start it, delete it, or create another one!

Step 5 − Download Appium jar files from Appium

Test an App with Appium

For testing an App with Appium, follow below steps

Step 1 − Create a test Project in the Android Studio named as “RobotiumTest”.

robotium

Choose all the default options until you reach to the main page.

Step 2 − Add the Appium jars into your project. Click Project → App → copy all the jars in lib. Select the copied jars except Selenium, Java client and Junit Jar, then right-click on it and click on "Add as Library".

Step 3 − Click on build.gradle in the App. You will see all the libraries added, as shown in below screenshot.

build

Step 4 − Now create a Java class as shown below

Step 5 − Running the Test case.

  • Click on build variant and select Unit Testing.
  • Start the Appium server with the specific port "4444".
  • Download the Appium for Windows from here.
  • Double click on the .exe and install Appium.
  • Click on the icon to up the UI.
  • Change the port if required, as shown below.
  • Click the Play button to start the server.

running test

  • Connect the device with USB debugging on or start an emulator.
  • Right-click the test class and click on "Run".

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Mobile Testing Topics