This is a two part series of test automation on android using Appium, C# and MSTest.
for part 2 click here.
C:Program Files (x86)Androidandroid-sdktools
C:Program Files (x86)Androidandroid-sdkplatform-tools
See the image below.
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.
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.
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.
for part 2 click here.
Prerequisites for this tutorial:
- Visual Studio Ultimate (2010 or above) (Because MSTest is present in that)
- Android SDK For Windows (Download Link) (Website link)
- Appium For Windows (Download Link) (Website Link)
- A Real Android Device running Android 4.2 or Above (I am using an Android Phone running Android 4.3)
- A USB Cable to attach your Android Phone to Your PC.
- 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 ";"
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.
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.
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.
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!
ReplyDeleteThanks a lot man, this was really helpful.
ReplyDelete