Android Automated Testing: Preparing the Environment:
Before doing the Android Automation test, you need to prepare the following environment on your computer, I use Appium to do the automated test.
- Install Appium server, installation path: http://appium.io/https://bitbucket.org/appium/appium.app/downloads/
- Appium need node JS, so need to install it, installation path: https://nodejs.org/en/after installation, you can open cmd, input node–v, if you can display the version of node, prove the successful installation.
Once installed, you can open Appium and start it, such as:
- Install Java JDK (Android is a Java-based development), installation path: http://www.oracle.com/technetwork/java/javase/downloads/index.html
After installation, you need to configure environment variables
|
|
C:\Program files\java\jdk1.8.0_101 (Installation path) |
|
|
.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar; |
|
|
%java_home%\bin;%java_home%\jre\bin; |
- Install Android SDK, installation path: https://developer.android.com/studio/index.html?gclid= Cjwkeajwmms-brcm5dn51jlbp1wsjacc61tfag0zqtzdgsydobbwbc1tkrebc1z_tn6qqtbq5lje0bocnddw_wcb
You will also need to configure environment variables after installation:
|
|
E : \development\android\android-sdk ( installation path ) |
|
|
%android_home%\ Platform-tools;%android_home%\tools; |
|
|
E:\DEVELOPMENT\ANDROID\ANDROID-SDK (Installation path) |
|
|
%android_home%\platform-tools;%android_home%\tools; |
- Open the Android SDK installation path, SDK Manager.exe, open it, update the Android SDK, select the tool that needs updating, click Install Packages
- Configure Android Emulator: Open the Android SDK installation path, find the AVD Manager.exe, open it, click Create, and then build the emulator (choose Device, Target,cpu ...)
- When everything is ready, open VS and install the following package
Open Tools, Neget Package Manager, package manage console
- Install-package Appium.webdriver
- Install-package Selenium.webdriver
- Install-package Selenium.support
- Install-package Newtonsoft.json
You can then write the automation test case.
Several of these important ADB commands:
- ADB devices---Examples of all device
- ADB install <path_to_apk>-installs the package to device
- ADB Push < Local path >< remote path >---Copying files from your computer to device
- ADB pull < remote path >< Local path >---Copy files from device to PC
- ADB shell--View files
Using CMD to create environment
- Install Appium server, install path:http://appium.io/
- Install the Node JS, install path:https://nodejs.org/en/
- Open the Appium server
- Start the Appium server
- Install the Java JDK, install path:http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Install the Android SDK, install PATH:HTTPS://DEVELOPER.ANDROID.COM/STUDIO/INDEX.HTML?GCLID=CJWKEAJWMMS-BRCM5DN51JL Bp1wsjacc61tfag0zqtzdgsydobbwbc1tkrebc1z_tn6qqtbq5lje0bocnddw_wcb
- ADD environment variables for Java and Android SDK, like the below screen shot:
- Create Android Emulator
- Start Emulator
- Install the PowerApp SDK
- Run PowerApp Test Cases
We can execute the below CMD to create the above step at WTT:
The step 1,2,5,6, we can copy the files and install it.
The Step 3, CMD: "C:\Program Files (x86) \appium\appium.exe"
The step 4:cmd: "C:\Program Files (x86) \appium\node_modules\.bin\appium.cmd"-A 127.0.0.1-p 4723
The step 7:we can change the registry value and see the below-screen shot:
The step 8:cmd:android create Avd-n emulatorname-t 7-b default/x86 (details, please refer to:http://blog.sina.com . cn/s/blog_4d353ac3010186c4.html)
The Step 9:cmd:emulator-avd avdname (go to the Android SDK tools path Firstly)
The Step 10:cmd:adb install ***.SDK
[Android-appium]: Android Automation test: Environment Preparation