ad

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 AppiumforWindows.zip 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.


46 comments:

  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!

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

    ReplyDelete
  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

    ReplyDelete
    Replies
    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.

      Delete
  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

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

    ReplyDelete
  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

    ReplyDelete
  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.

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  15. Thanks for your post. This is excellent information. The list of your blogs is very helpful for those who want to learn, It is amazing!!! You have been helping many application.
    best selenium training in chennai | best selenium training institute in chennai selenium training in chennai | best selenium training in chennai | selenium training in Velachery |

    ReplyDelete
  16. The latest android SDK I have downloaded (for windows system 64 bit) and installed that does not contain Tool and platform_tool folders. Please help

    ReplyDelete
  17. Roulette online is fun as well as skydiving is only safer and free. internet roulette online Win big amounts just now and have nothing to regret.

    ReplyDelete
  18. You are doing a great job. I would like to appreciate your work for good accuracy
    Regards,
    Best Devops Training in Chennai | Best Devops Training Institute in Chennai

    ReplyDelete
  19. Разноцветная светодиодная лента или как ее еще называют светодиодная лента rgb наверое одно из лучших изобретений которое придумали люди, очень забавная штука.

    ReplyDelete
  20. I found a good site, the main thing is that here I am not cheating everything honestly honest play for real money casino I sit play, have fun

    ReplyDelete
  21. This is best one article so far I have read online, I would like to appreciate you for making it very simple and easy
    Regards,
    Devops Training in Chennai | Devops Certification in Chennai

    ReplyDelete

  22. Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
    moto g service center in chennai
    motorola service center in velachery
    motorola service center in t nagar

    ReplyDelete
  23. The iPhone countered this via the launch of new phones along with the compulsion to use the iTunes interface to ensure that the phone software was up-to-date. gerald winata gozali

    ReplyDelete
  24. A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
    Oracle Fusion Financials Online Training
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training

    ReplyDelete
  25. Nice Post! Thank you for sharing knowledge, it was very good post to update my knowledge and improve my skills. keep blogging.
    Java Training in Electronic City

    ReplyDelete
  26. Get the best nursing services baby care services medical equipment services and allso get the physiotherapist at home in Delhi NCR For more information visit our site

    nursing attendant services in Delhi NCR
    medical equipment services in Delhi NCR
    nursing services in Delhi NCR
    physiotherapist at home in Delhi NCR
    baby care services in Delhi NCR

    ReplyDelete
  27. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops Training in Electronic City

    ReplyDelete
  28. This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. Binary options recovery

    ReplyDelete
  29. Agarwal Packers and Movers are the best as always but last time I faced little difficulty with them. As one of the staff of them was not doing his job properly. I told him to do things as I am saying but he was ignoring me completely. I even complained about him and later on, they apologize to me and that staff also.

    Agarwal Packers Reviews
    Agarwal Packers Feedback
    Agarwal Packers Complaint

    ReplyDelete
  30. You've made some good points there. I looked on the internet for additional information about the issue and found most people will go along with your views on this website.
    Java Training in Bangalore
    Advanced Java Training in Bangalore

    ReplyDelete