搭建Eclipse+UIAutomator 环境
来源:互联网 发布:阿隆戈登数据 虎扑nba 编辑:程序博客网 时间:2024/06/01 09:05
在前面一篇文章中已经介绍了如何搭建 Java+Eclipse环境,现在介绍下如何在Eclipse基础上搭建UIAutomator环境,进行移动端测试。
第一步:安装Android SDK
Link:http://developer.android.com/sdk/installing/index.html . 因为是在Eclipse下,我选的是Stand-alone SDK Tools。进行Download 和Install.
设置环境变量:ANDROID_HOME = D:\Program Files (x86)\Android\android-sdk
设置Path:Path= ;%ANDROID_HOME%\tools
第二步:在Eclipse中安装ADT(AndroidDeveloperTools) 插件及配置
SDK Tools Integration
Many of the tools that you can start or run from the command line are integrated into ADT. They include:
Traceview: Allows you to profile your program's execution (Window > Open Perspective > Traceview).
android: Provides access to the Android SDK Manager and AVD Manager. Other android features such as creating or updating projects (application and library) are integrated throughout the Eclipse IDE.
Hierarchy Viewer: Allows you to visualize your application's view hierarchy to find inefficiencies (Window > Open Perspective > Hierarchy Viewer).
Pixel Perfect: Allows you to closely examine your UI to help with designing and building. (Window > Open Perspective > Pixel Perfect).
DDMS: Provides debugging features including: screen capturing, thread and heap information, and logcat (Window > Open Perspective > DDMS).
adb: Provides access to a device from your development system. Some features of adb are integrated into ADT such as project installation (Eclipse run menu), file transfer, device enumeration, and logcat (DDMS). You must access the more advanced features of adb, such as shell commands, from the command line.
ProGuard: Allows code obfuscation, shrinking, and optimization. ADT integrates ProGuard as part of the build, if you enable it.
插件link: https://dl-ssl.google.com/android/eclipse/
To add the ADT plugin to Eclipse 步骤:
(1)Start Eclipse, then select Help > Install New Software.
(2)Click Add, in the top-right corner.
(3)In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/
(4)Note: The Android Developer Tools update site requires a secure connection. Make sure the update site URL you enter starts with HTTPS.Click OK.
(5)In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
(6)In the next window, you'll see a list of the tools to be downloaded. Click Next.
(7) Read and accept the license agreements, then click Finish.
(8)If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
When the installation completes, restart Eclipse.
配置ADT Plugin
在Eclipse重启后,你需要指定Android SDK directory
(1)In the "Welcome to Android Development" window that appears, select Use existing SDKs.Browse and select the location of the Android SDK directory you recently downloaded and unpacked. Click Next.
(2)Your Eclipse IDE is now set up to develop Android apps, but you need to add the latest SDK platform tools and an Android platform to your environment. To get these packages for your SDK, continue to Adding Platforms and Packages.
第三步 在Ecliplse中创建UIAutomator 测试project
(1)在Eclipse中创建一个JavaProject。
(2)添加jar, 点击Java Project,Menu - Project — Properties, Java Build Path - Libraries,Add External JARs... - 把android-sdk\platform\android-xx里面的android.jar和uiautomator.jar添加进来, Add Library... - 添加JUnit - JUnit3类库
(3)在src里添加目录src/com/uia/example/my
(4)在my下添加一个JUnit Test Case,名为LaunchSettings
(5)把http://developer.android.com/tools/testing/testing_ui.html下的sample复制黏贴至testcase,保存
(6)打开cmd运行命令:
- <android-sdk>/tools> android create uitest-project -n <name> -t 1 -p <path> (<name>就是LaunchSettings, <path>就是项目所在目录), 这时会发现在Project目录下有个build xml生成
(7)修改build.xml文件中的default=bulid
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyAndroidTest" default="build">
(8)可以切换到项目所在目录(build.xml文件所在目录),运行
- ant build
完成后会在/bin下生成LaunchSettings.jar
也可以直接在Eclipse中,右击“build.xml” 选择“Run As—>Ant Build”, 我选择的是这种方法
(9)使用adb push命令,把test case(LaunchSettings.jar)上传到被测试设备上
- <android-sdk>\platform-tools>adb push <path_to_output_jar> /data/local/tmp/ (<path_to_output_jar>:jar的文件目录)
(10)最后,运行命令,那个sample的test case就会在设备上跑起来了。
- <android-sdk>\platform-tools>adb shell uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings
- 搭建Eclipse+UIAutomator 环境
- Uiautomator环境搭建
- UiAutomator 测试环境搭建
- Android uiautomator环境搭建
- uiautomator 环境搭建
- python+uiautomator环境搭建
- Uiautomator自动化测试环境搭建eclipse+sdk+ADT
- 超详细搭建UIautomator环境
- Android UiAutomator 自动化环境搭建
- python+uiautomator测试环境搭建
- python+uiautomator测试环境搭建
- Uiautomator自动化测试环境搭建eclipse+sdk+ADT——小白入门超详细
- UiAutomator环境搭建及详细操作
- UiAutomator环境搭建及详细操作
- Uiautomator小记之 环境搭建-Android
- Uiautomator小记之 环境搭建-JAVA
- uiautomator搭建
- 搭建eclipse环境 Eclipse
- 2015-03-19 SQL Server 批量插入数据的两种方法
- linux centos下安装dokuwiki
- 寻找和为定值的两个数
- ASP.NET profile之 找不到存储过程dbo.aspnet_CheckSchemaVersion
- Linux那些事儿之我是Sysfs(1)sysfs初探
- 搭建Eclipse+UIAutomator 环境
- logstash+elasticsearch+kibana3
- Sqrt(x)
- Java基础视频教程第22天_GUI(了解即可)
- poj 3461 Oulipo (KMP 模板题)
- Android 开机启动流程
- 两则预防crontab重复执行任务策略
- 基于Givens变换的QR分解
- 1. 了解Web及网络基础