Appium [opendx] 基于 appium 的移动端 UI 自动化测试平台-介绍篇

jiangyitao · 2020年04月10日 · 最后由 甬力君 回复于 2020年10月07日 · 4630 次阅读

写在前面

opendx 适用于团队协作,使用简单、灵活。如果你想学习平台开发技术,opendx 也是个不错的选择。

核心能力

  • opendx 是一个平台化产品,使用与推广都非常容易。部署完成后,使用者有浏览器就可以开始使用
  • opendx 实现了实时调试hot-debug功能,可以帮助你大幅减少用例编写与调试时间
  • opendx 提供了内嵌 java 代码的功能,通过内嵌代码我们可以实现更灵活的业务需求
  • opendx 实现了编程中函数(方法)的等价功能,我们可以自由地对业务进行封装与调用
  • opendx 支持横向扩展,你可以接入更多的移动设备,来加速整个测试过程

使用指南(有声音)

  • 指南 1/
  • 指南 2/
  • 指南 3/

一幅图概括 opendx

写在最后

由于个人能力精力有限,平台仍然存在很多不足,opendx 的成长需要大家的帮助

  • 分享你的使用经验
  • 帮助完善代码与文档
共收到 14 条回复 时间 点赞

感谢大佬分享,使用起来确实很棒!

这个测试平台做的太赞了

平台做得挺好,但是还是无法避免,不写脚本的 UI 自动化维护成本过高的问题;
还是建议写脚本,灵活性更高,且可以降低将脚本转化为 Web 操作的坑和工作量;

在路上 回复

有空可以看下指南 2,也许会有不一样的看法

看到了,平台做的挺好的,因为我们去年的做法跟你的方式差不多,但是效果真心不好。
今年直接规划好测试规范,让大家写脚本了,稳定性有所提升;

感谢分享,演示看起来很棒!

功能挺强大的,后期更新,支持下 python,测试用的多点

用了好一阵子了,目前可以支持项目组回归测试的需求,期待更多更新!

楼主,我这遇到两个问题:

1、agent 设备注册成功后连接的设备是黑屏状态?页面元素获取、放大功能可用

2、点击页面上的home键报错:实在找不到为什么发送命令的时候会异常关闭 socket 连接😂 😂 😂

2020-08-07 16:06:51.598  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m<-- GET /wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/screenshot [39m[32m200[39m [90m2741 ms - 1381324[39m
2020-08-07 16:06:51.599  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m[39m
2020-08-07 16:06:51.772  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/context[39m
2020-08-07 16:06:51.773  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m{}[39m
2020-08-07 16:06:51.775  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Calling AppiumDriver.getCurrentContext() with args: ["0731beab-ff49-472e-887a-cd7851a4158e"]
2020-08-07 16:06:51.778  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
2020-08-07 16:06:51.779  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m<-- GET /wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/context [39m[32m200[39m [90m3 ms - 22[39m
2020-08-07 16:06:51.780  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m[39m
2020-08-07 16:06:51.781  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/window/rect[39m
2020-08-07 16:06:51.782  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m{}[39m
2020-08-07 16:06:51.783  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Calling AppiumDriver.getWindowRect() with args: ["0731beab-ff49-472e-887a-cd7851a4158e"]
2020-08-07 16:06:51.790  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m Sending command to android: {"cmd":"action","action":"getDeviceSize","params":{}}
2020-08-07 16:06:51.790  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"getDeviceSize","params":{}}
2020-08-07 16:06:51.791  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
2020-08-07 16:06:51.794  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: getDeviceSize
2020-08-07 16:06:51.795  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":{"height":1920,"width":1080}}
2020-08-07 16:06:51.798  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
2020-08-07 16:06:51.798  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Responding to client with driver.getWindowRect() result: {"width":1080,"height":1920,"x":0,"y":0}
2020-08-07 16:06:51.798  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m<-- GET /wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/window/rect [39m[32m200[39m [90m8 ms - 50[39m
2020-08-07 16:06:51.798  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m[39m
2020-08-07 16:06:51.799  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/orientation[39m
2020-08-07 16:06:51.799  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m{}[39m
2020-08-07 16:06:51.799  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Calling AppiumDriver.getOrientation() with args: ["0731beab-ff49-472e-887a-cd7851a4158e"]
2020-08-07 16:06:51.803  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m Sending command to android: {"cmd":"action","action":"orientation","params":{"naturalOrientation":false}}
2020-08-07 16:06:51.804  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"orientation","params":{"naturalOrientation":false}}
2020-08-07 16:06:51.804  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
2020-08-07 16:06:51.804  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: orientation
2020-08-07 16:06:51.805  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
2020-08-07 16:06:51.805  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[W3C (0731beab)][39m Responding to client with driver.getOrientation() result: "PORTRAIT"
2020-08-07 16:06:51.806  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [37m<-- GET /wd/hub/session/0731beab-ff49-472e-887a-cd7851a4158e/orientation [39m[32m200[39m [90m6 ms - 20[39m
2020-08-07 16:06:51.806  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][35m[HTTP][39m [90m[39m
2020-08-07 16:06:51.806  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Current rotation: ROTATION_0
2020-08-07 16:06:51.807  INFO 9704 --- [c Stream Pumper] com.daxiang.utils.Terminal               : [Terminal][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"PORTRAIT"}
2020-08-07 16:07:33.713  INFO 9704 --- [      Thread-38] c.d.core.mobile.MobileChangeHandler      : [M95QACPDMD2YG]断开连接
2020-08-07 16:14:52.084  INFO 9704 --- [.1-10004-exec-5] c.d.core.mobile.android.scrcpy.Scrcpy    : Scrcpy >>>>>>>>>>>>>>>>>>>>>>>>>>>> commitKeycode
2020-08-07 16:14:52.085  INFO 9704 --- [.1-10004-exec-5] c.d.core.mobile.android.scrcpy.Scrcpy    : Scrcpy >>>>>>>>>>>>>>>>>>>>>>>>>>>> commit
2020-08-07 16:14:52.091 ERROR 9704 --- [.1-10004-exec-5] c.d.core.mobile.android.scrcpy.Scrcpy    : [127.0.0.1:62001]commit msg err

java.net.SocketException: Software caused connection abort: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method) ~[na:1.8.0_131]
        at java.net.SocketOutputStream.socketWrite(Unknown Source) ~[na:1.8.0_131]
        at java.net.SocketOutputStream.write(Unknown Source) ~[na:1.8.0_131]
        at com.daxiang.core.mobile.android.scrcpy.Scrcpy.commit(Scrcpy.java:314) [classes!/:0.7.6]
        at com.daxiang.core.mobile.android.scrcpy.Scrcpy.commitKeycode(Scrcpy.java:308) [classes!/:0.7.6]
        at com.daxiang.core.mobile.android.scrcpy.Scrcpy.home(Scrcpy.java:230) [classes!/:0.7.6]
        at com.daxiang.websocket.AndroidScrcpySocketServer.onMessage(AndroidScrcpySocketServer.java:72) [classes!/:0.7.6]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_131]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_131]
        at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:80) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:395) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:119) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:82) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
        at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_131]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_131]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.17.jar:9.0.17]
        at java.lang.Thread.run(Unknown Source) [na:1.8.0_131]



onesbyones 回复

这个设备应该不支持 scrcpy

仅楼主可见

最近也在研究这个东西,前端不熟,写的蛋疼

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册