Getting Started with Appium Using an Android Virtual Device and Eclipse


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

javafx

Database Operations in JavaFX

By Onur Baskirt / Apr 1, 2016 / 56 Comments
Before started this section, please check the first article and learn How to Start JAVAFX! http://www.swtestacademy.com/getting-started-with-javafx/ At first, part of JavaFX tutorial series, we created a sample JavaFX project, designed the draft version of the UI and set up an...
rest assured

REST API Testing with Rest Assured

By Onur Baskirt / Mar 8, 2016 / 32 Comments
Outline In this post, I will explain what is API and API testing, what is the difference between SOAP and REST services, and how to test REST APIs with Rest Assured Library. What is API? API stands for Application Programming...
extentreports

How to Write Effective CSS Locators

By Onur Baskirt / Oct 1, 2017 / 0 Comments
Hi all, in this tutorial, I will describe you how to write effective CSS locators to interrogate web elements for your automation projects. As a rule of thumb, your interrogation strategy should be in below order: First try to use...
extentreports

Selenium-11: Execute JavaScript with JavascriptExecutor

By Onur Baskirt / Jan 27, 2016 / 15 Comments
Outline Sometimes we cannot handle some conditions or problems with Webdriver, web controls don't react well against selenium commands. In this kind of situations, we use Javascript. It is useful for custom synchronizations, hide or show the web elements, change...
javafx

Getting Started with JavaFX

By Onur Baskirt / Mar 25, 2016 / 0 Comments
When I started to work in my current position, one of my task is to do manual operations for campaign products  every week. After the second week, I thought that I have to automate this task using a GUI based...
extentreports

How to Write Smart XPath Locators

By Onur Baskirt / Sep 24, 2017 / 4 Comments
Hi all, in this tutorial, I will describe you how to write smart and non-brittle XPath locators. When we write our test scripts, we generally prefer to use id, name, class, etc. these kinds of locators. However, sometimes we could not...
extentreports

Selenium-1: Quick Start to Automation with Selenium WebDriver & JAVA & JUnit & Maven & IntelliJ

By Onur Baskirt / Sep 8, 2015 / 26 Comments
Outline Selenium Webdriver is the most popular open source web test automation framework across wide range of browsers and platforms. In this tutorial you will learn how to do web test automation with Selenium Webdriver and the related tools. Audience...
page object model

Page Object Model with C#

By Ege Aksoz / Jun 18, 2017 / 8 Comments
In the previous tutorial, we’ve taken the initial steps and entered the world of automated testing. We also wrote our first automated test. From this point on, since we are not just going to write one test, we need to...
extentreports

How to Select a Date From DatePicker Using Selenium

By Onur Baskirt / Aug 13, 2016 / 6 Comments
When you need to automate a airway, hotel, or similar websites you need to deal with Datepickers and some times it is a little bit cumbersome to select a specific date on the Datepicker or calendar.  In this post, I...
extentreports

Selenium Webdriver Performance testing with Jmeter and Selenium Grid

By Ozgur Kaya / Aug 9, 2016 / 2 Comments
In this post, we will complete Selenium Webdriver Performance testing scenario using Jmeter and Selenium Grid. 1- Install Java 7 or later If necessary https://java.com/tr/download/ 2- Download latest Jmeter version 3.0 or higher. http://jmeter.apache.org/download_jmeter.cgi 3- Download Jmeter PluginsManager JAR file and...
By | 2017-01-13T21:33:43+00:00 March 14th, 2016|Appium, Mobile Automation, Test Automation|0 Comments

About the Author:

James Koch
Hello! My name is James Koch, CTFL, Solutions Architect for Quilmont, an advanced automation firm based out of Myrtle Beach, South Carolina. I currently work remotely, in charge of our Atlanta territory as our company is growing all across the south east U.S. I am a certified software tester through the International Software Test Qualification Board(ISTQB) and am an active member of the ASTQB. I started as a software test engineer with Sirius XM Satellite Radio and worked on everything from their mobile application, to regression testing on CE and OEM devices. That is where my passion for testing software and QA began. With a high focus in Automated Testing, Total Quality Management, and Software Quality Assurance, I strive to understand, diagnose, and correct behaviors by formulating solutions in software and other day-to-day business operations to reach optimal performance. I apply my operations background to software development and work well with Agile and DevOps practices. I understand philosophies for automating testing by being well versed in the most popular frameworks, the latest being Appium. I apply automation frameworks to develop, execute, organize, and maintain test plans to better assist clients getting through testing in an effective efficient manner. I've developed Web Services for clients to easily interact with their in-house systems. I possess the ability to coordinate multi-organizational structures such as OEM Applications Engineering, Contract Manufacturing and Test Validation Sites. I posses analytic skills in planning, process, and creating efficiency. I have knowledge of Hardware circuitry design in the areas of power supplies and microprocessors. My hobbies include lacrosse, fishing, hiking and camping with my dog and wonderful fiancé. My relationship with Software Test Academy was reciprocated in February 2016 and it is a pleasure to contribute. For Quilmont and myself, 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.

Leave A Comment