Outline

In this post I will be showing you how to run a simple calculator app script in Eclipse, using Android SDK on a virtual device, and Appium. Over the past few years, more and more firms are using Appium for the development of their applications. Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS and Android apps using the WebDriver protocol. There are tons of resources out there on how to get started and I wanted to share my approach being that it is straight forward and I have it fresh in my mind. It took some trial and error, but I believe with these steps, you will be able to use them as a template for setting up any kind of TC with Appium.

Feel free to leave questions or comments below!

Lets Get Started to Appium Using Android Virtual Device

For my approach, I have laid out the different versions of software I used. These versions you do not need specifically, but Appium, Eclipse, and Android may require more advanced releases than what you are currently running. These worked fine for me!

Prerequisites

Setup

  • Begin with downloading Appium, unzip the package, and follow the step to install.
  • Install Android SDK in your system.

Go to Control panel ->> System and Security ->> System and from the left panel click on ‘Advance System Settings‘. From ‘System Properties‘ pop up, click on ‘Advance‘ tab and then click on “Environment Variables” button.

appium

From ‘Environment variables‘ pop up, double click on ‘Path‘ and set ANDROID_HOME variable that point to your SDK directory. In the path append the whole SDK folder path. Make sure it is separated by a semi-colon e.g.- ; C:\User\ABC\Desktop\adt-bundled-windows-x86_64-20140321\sdk

appium

Eclipse

  • Install Eclipse, create a new work space
  • Android ADT and TestNG
    • For TestNG, In the Help drop-down select Install new Software->> Add->> and copy this link to the location: http://beust.com/eclipse
    • After Eclipse restarts, we will be doing the same for the ADT with: https://dl-ssl.google.com/android/eclipse/

appium_android_3

Eclipse will restart again and you will begin making the connection points.

  • You will see the SDK manager set up the first time you install Android.
  • If not, go to Windows->> Preferences, under Android set the path to the SDK on your computer and press OK.

appium

  • I already have the platforms above installed so you will not see them until you do so. To set up, go to windows->>SDK Manager, or click the icon on the task bar. These packages take a while to install, so for our intents and purposes we will only be installing API level 17.

android appium

  • I received an error when attempting to start my emulator, so in extras I also had to install Intel x86 Emulator Accelerator (HAXM installer) as well.

appium

I also had to go into where my SDK folder is ->>extras ->>intel ->> Hardware Accelerated Execution Manager->> and run the intelhaxm-android application.

mobile testing

Setting Up the Test Case

  • File->> add a new Java project, name it and->> next. This is where we are going to be setting up our jar files. (You can get here by right clicking a project->> build path->> customize path as well)
    • Under Libraries tab->> Add External Jars->> the Test NG jar from where you stored it, and the Appium java client library.
    • Add the Selenium Jar file 2.45.0
    • Also, in the Selenium folder, go into the libs folder and import all Jars in this folder. This may not be necessary depending on what you want your program to do; I just like having them all at my disposal.

android

  • Now you are ready to start scripting!!!

Test Code for the Calculator Application

Almost there! Now we need to set up our Emulator in AVD Manager. In the Manager dialog select create. This will bring up a form that you will use to set up the device. I called my device Emulator, but you can go with a different conventional name, just be sure it matches in you code and in Appium. If you set yours up like this you should have no problem with your device:

emulator

  • Click OK, and start your device
  • Now we can run Appium! In Android settings, set it up to match your device and give the path to your SDK.

android

  • Make sure only necessary boxes are selected.
  • Your server should be set up to default as below, so all that’s left to do is run the server, note this is the server from my code.

appium

  • If server is started correctly your prompt should look similar to this this:

server

  • With the device loaded, we are ready to run the script by right clicking and run as TestNG. The calculator app will open and the functions will execute.

Conclusion

Attached is a video of the execution of this test case, A few things to point out, again this tutorial has been set up by pooling resources from several locations. A lot of my set up was through trial and error, but if you follow these steps you should have a working TC. The scenario you may be looking for may not be the same, but this is a convenient way to build a TC with Appium. Appium has a great deal of functionality, whether it be simply helping with execution of test cases or passing parameters to your tests.

To get a better understanding of Appium and for our partner Quilmont’s consulting practices with automation visit their website at Quilmont.com. Quilmont provides organizations with a comprehensive testing practice by fully utilizing industry leading software testing tools for mobile, web, and desktop applications. We (swtestacademy.com) thank Quilmont’s Solution Architect James Koch and CEO Patrick Quilter for their collaboration with us.

For execution, see YouTube video below

Visit Quilmont Website

qm logo7_email

Quilmont was established in 2007 by our owner and CEO Patrick Quilter. Patrick has over 15 years of experience in software development life cycle & test automation architecture. Quilmont owns a patented product called Test Case Manager, an automation framework that allows firms to get more out of their scripting tools. Quilmont was founded in Washington D.C., being so, we are still connected with several prime government contractors in the area that reach out to us when they need help; we are currently registered in the SAM database. Our partnerships include Polarion, HP, and Keynote Studios. We provide organizations with a comprehensive testing practice by fully utilizing industry leading software testing tools.

Quilmont has had projects of all different kinds and scope; from working with startups, government contracts, and even large fortune 500 companies like Berkshire Hathaway/Geico. Unlike the other products and consulting services on the market, Quilmont provides its clients with the most cost effective and best personalized solution to fit its automation needs. We provide customer service and support, and offer training. At Quilmont it is our mission to form strategic relationships with other enthusiastic automated testing organizations. We utilize next generation technologies to virtually distribute our solutions globally while providing our workforce with opportunities to enhance their IT skills.

Visit Quilmont Website