`

How do I debug UiAutomator scripts with Eclipse

阅读更多
网上千篇一律的介绍UiAutomator测试了,近期在用UiAutomator写UI自动自动化测试,在开发scripts过程中发现写的TestCase过多了调试很不方便。使用打印log调试效率特别低。在Android Deveplopers官网上有adb shell uiautomator runtest XXX.jar -e debug true -c + 类名,在启动Uiautomator测试之前等待一个debug模式连接手机。但在官网上没找到如何debug。在Google中看到一个,立马分享晒一晒

理解的关键在于如何使用DDMS(Dalvik Debug Monitor Server),并且通过Eclipse里的java进行远程debug(即在pc端远程debug手机端中的uiautomator)。

以下是远程debug Uiautomator测试的的具体操作步骤:

   1、 启动Debug Configration,并在此创建一个实例,用于加载UiAutomaotr Project,使UiAutomaotr Project在debug调试中按照自己定义的模型运行,如图11.jpg,22.jpg所示

  

 

  备注:其中的Port端口号建议自己另外定义。因为默认的端口号容易被其他进程占用,会导致后面Debug失败的现象。我第一次就没定义启动失败告终。

2、在cmd中运行命令ant build把编写好的UiAutomator scripts打成一个jar包,运行adb push xxxx.jar /data/local/tmp 把包push到手机中,运行命令adb shell uiautomator runtest XXX.jar -e debug true -c Class_Name(可以实现一键自动化,即运行ant run即可实现上述所有的操作)。在cmd会出现如图所示,即在启动uiautomator测试之前等待debug连接:


3、启动Eclipse中的DDMS,如图所示:

   ,可以看到一个红色的虫子,那个就是还代表设置成功

4、切回到Java编辑页面,在Script中打好断点,用之前在Debug Configration中编辑好的debug来启动,如图所示:

  • 大小: 680.3 KB
  • 大小: 413.1 KB
  • 大小: 30.1 KB
  • 大小: 483.3 KB
  • 大小: 352.6 KB
分享到:
评论

相关推荐

    geoprocessing scripts with python.pdf

    ### Geoprocessing Scripts with Python: Key Concepts and Applications #### Scripting and Python in GIS Context In Geographic Information Systems (GIS) modeling and data management, scripting plays a ...

    PHP CLI: Create Command Line Interface Scripts with PHP

    How to deal with user input and console output How to work with helper libraries and software What the differences are between programming for the web and for the CLI and more Who is this book for ...

    FortiAP_Debug_Scripts

    【标题】"FortiAP_Debug_Scripts"是一个与Fortinet的FortiAP设备相关的调试脚本集合,主要用于解决网络接入点(Access Point, AP)的问题。FortiAP是Fortinet公司提供的一种网络安全设备,用于无线局域网(WLAN)的...

    r scripts for dealing with mturk survey

    R scripts for dealing with mturk

    rofi-scripts, 用于rofi的小型脚本.zip

    rofi-scripts, 用于rofi的小型脚本 基于 Rofi的脚本 i3_switch_workspace.sh用法./i3_switch_workspace.sh屏幕截图 monitor_layout.sh用法./monitor_

    Selenium WebDriver Recipes in C#(Apress,2ed,2015)

    How to debug test scripts and test data How to manage and deal with browser profiles and capabilities< How to manage tests for advanced user interactions and experiences (UX) How to work with and ...

    How to Use Live Scripts in MATLAB.zip

    "How to Use Live Scripts in MATLAB" 是一个关于如何在MATLAB环境中利用Live Scripts进行工作的教程。Live Scripts是MATLAB的一项创新功能,它将代码、文本、图像、交互式控件和输出结果集成在一个单一的可执行文档...

    Mastering Nmap Scripting Engine-2015.pdf

    questions received on the Nmap development mailing list: “How do I start writing NSE scripts?” I have tried to explain each of the concepts with examples and specific task implementations. Expect to...

    i-doit-scripts:维护 i-doit 的有用脚本

    维护 i-doit 的有用脚本 关于 是用于 IT 文档和 CMDB(配置管理数据库)的软件应用程序。 此应用程序对于收集有关您正在处理的 IT 基础设施的所有知识非常有用。 i-doit 是一个 Web 应用程序,它非常有用的 ,它对于...

    Manning - Eclipse In Action.pdf

    This approach ensures that readers not only learn how to develop software with Eclipse but also understand how to customize and extend the IDE to meet their specific needs. #### Part I: Using ...

    Python库 | ci-scripts-1.15.3.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:ci-scripts-1.15.3.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    PyPI 官网下载 | ci_scripts-1.18.0-py3-none-any.whl

    《PyPI官网下载:ci_scripts-1.18.0-py3-none-any.whl——CI与Python库的集成实践》 在Python开发过程中,持续集成(Continuous Integration, CI)是一个至关重要的环节,它能够自动构建、测试和部署代码,确保项目...

    How.to.Do.Everything.with.JavaScript

    This friendly, solutions-oriented guide is filled with step-by-step examples that illustrate how to write basic to advanced JavaScript applications, as well as modify existing scripts to suit ...

    XML Processing with Perl, Python, and PHP (2002).pdf

    Do I play with a free text-retrieval system again? If I use a database system, how will I transfer my contacts from my desktop Mac to my portable Windows notebook or to Palm? If I want to view the ...

    PyPI 官网下载 | ci_scripts-1.2.0-py3-none-any.whl

    标题中的“PyPI 官网下载 | ci_scripts-1.2.0-py3-none-any.whl”表明这是一个从Python的官方包索引(PyPI)下载的软件包,名为`ci_scripts`,版本为1.2.0,且它是为Python 3编译的。在Python生态系统中,PyPI...

    How to use SFTP

    How to use SFTP (with client validation - public key authentication) The topic How to use SFTP (with client validation - password authentication) discusses the simplest form of client ...

    cmake4eclipse-2.0.1.zip

    This Eclipse plugin automatically generates build-scripts for the Eclipse CDT managed build system from CMake scripts and runs the build. Automatic generation of build scripts. No need to manually...

    Linux Shell Scripting Essentials(PACKT,2015)

    Discover how to write shell scripts easily, execute script files, debug, and handle errors. Next, you’ll explore environment variables in shell programming and learn how to customize them and add a...

    Beginning JavaScript with DOM Scripting and Ajax: Second Editon

    you will also learn how to work with the Browser Object Model, the Document Object Model (DOM), how to use XML and JSON as well as communicate with service side scripts such as PHP. Find out how to: ...

Global site tag (gtag.js) - Google Analytics