Sunday, March 27, 2016

Test Automation on Android using Appium, C# and MSTest

This is a two part series of test automation on android using Appium, C# and MSTest.
for part 2 click here.

Prerequisites for this tutorial:

  1. Visual Studio Ultimate (2010 or above) (Because MSTest is present in that)
  2. Android SDK For Windows (Download Link) (Website link)
  3. Appium For Windows (Download Link) (Website Link)
  4. A Real Android Device running Android 4.2 or Above (I am using an Android Phone running Android 4.3)
  5. A USB Cable to attach your Android Phone to Your PC.
  6. ADB Interface Drivers for your Phone (Link on how to get that ) (very important Step)

Some Configurations for Android SDK and Appium:

  • When you have installed Android SDK, go to My Computer, right click , click Properties, click Advanced System Settings, click Environment Variables.
  • Create a new User Variable with the name "ANDROID_HOME". Give path to your sdk folder in the value. The default path is  C:Program Files (x86)Androidandroid-sdk

  • Edit the PATH variable in "System Variable" Section. Append the path to your tools folder and platform-tools folder. Separated with ";"
The paths are
C:Program Files (x86)Androidandroid-sdktools
C:Program Files (x86)Androidandroid-sdkplatform-tools
See the image below.

  •  Connect your Android Phone with USB Cable. To make sure your android phone is connected with your PC, we have to do following.
Go to C:Program Files (x86)Androidandroid-sdktools. Click on "uiautomatorviewer.bat". A window will open. See Image.

 You can use this window to inspect the elements of your app in android. Open the calculator app in your android device and click on "Device ScreenShot" button on this screen. If you receive this error message "No Android devices were found by adb"

That means adb interface drivers are not installed on your system. You have to read again point number 6 in the Prerequisites section. If android device is successfully connected, you should see a snapshot along with Object Map in this window like this.

  • Unzip in a folder. Open Appium.exe, you should see a window like this.

Click on the android Icon on the top left of this window. You will see a window in which you can configure the platform and version of your android on which you want to test. I have filled the following configurations there.

Now click on the Play button on the top right corner of the window. Appium server will start with the configurations you have provided.

  • Developer options should be enabled on your android phone, with these two options.
Usb Debugging should be enabled.
StayAwake should be enabled.
If you reach till here, Congratulations, You have successfully configured all the required prerequisites .
In the second part, I will show how to code and run this script on your real android device.


  1. Thanks for this - it has been extremely helpful! Just a note, the link to second part (last sentence above) does not link properly. Overall, this has been excellent though!

  2. Thanks a lot man, this was really helpful.

  3. iZombie Season 3 will portray Liv gulping down the brain of a dominatrix. Therefore, we can expect the upcoming installment to be more engaging than the previous ones. iZombie Season 3 Cast

    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.

  4. hello!,I like your writing so a lot! percentage we keep in touch more approximately your article on AOL? I need a specialist in this space to unravel my problem. May be that's you! Looking forward to see you. gmail email login

  5. There are many android phones available throughout the world. Many of them have not appeared in North America, however. oukitelcentral

  6. Be that as it may, the receptiveness and its enormous piece of the overall industry made Android helpless against visit security assaults.more information

  7. An open source tool that is required for mobile web, automating Native and hybrid application on Android and IOS platform is known as Appium which was in 2012. Appium is considered to be a cross platform that will low you to write tests which is against multiple platforms like Android and IOS. They do this using the same API. Know More info Click Here:: Appium IOS.

  8. For instance, a binary options investor may look at a company stock that is currently valued at $20 per share and bet $100 that the price will rise to $20.50 or higher by the end of the day.Binary Options Beginners guide

  9. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    python training institute in marathahalli | python training institute in btm

  10. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Devops interview questions and answers

  11. Were a gaggle of volunteers as well as starting off a brand new gumption within a community. Your blog furnished us precious details to be effective on. You've got completed any amazing work!
    Java training in Bangalore | Java training in Rajaji nagar

    Java training in Bangalore | Java training in Marathahalli

    Java training in Bangalore | Java training in Btm layout

    Java training in Bangalore | Java training in Marathahalli

  12. Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.

    AWS Training in Pune | Best Amazon Web Services Training in Pune

  13. This is beyond doubt a blog significant to follow. You’ve dig up a great deal to say about this topic, and so much awareness. I believe that you recognize how to construct people pay attention to what you have to pronounce, particularly with a concern that’s so vital. I am pleased to suggest this blog.
    Data Science course in rajaji nagar
    Data Science with Python course in chenni
    Data Science course in electronic city
    Data Science course in USA
    Data science course in pune | Data Science Training institute in Pune

  14. You have outdone yourself this time. It is probably the best, most short step by step guide that I have ever seen. Binary Strategy