一个带界面的Wukong 原创 精华
左翼风发
发布于 2023-12-14 09:58
浏览
1收藏
简介
在OpenHarmony仓里有一个稳定性自动化测试工具,叫Wukong。对应的仓位置是https://gitee.com/openharmony/ostest_wukong。这个工具是系统自带的命令行工具,下面先简单介绍下wukong的内容
架构图
Wukong内子模块职责:
-
命令行解析:支持命令行获取参数并解析命令行参数。
-
运行环境管理:根据命令行初始化wukong整体运行环境。
-
系统接口管理:检查并获取指定的mgr,注册controller和dfx的faultlog的回调函数。
-
随机事件生成:通过random函数生成指定种子数的随机序列,生成事件。
-
事件注入:根据支持的事件类型向系统注入事件,依赖窗口、多模、安全等子系统。
-
异常捕获处理/报告生成:通过DFX子系统获取运行中的异常信息并记录log,生成报告。
Wukong命令
# wukong help
usage: wukong <command> [<arguments>]
These are common wukong command list:
help wukong help information
-v/--version wukong version
exec run random test
special run special test
focus run focus test
appinfo show all app information
-
Wukong special是专项测试,具体测试命令如下
# wukong special -h usage: wukong special [<arguments>] These are wukong special arguments list: -h, --help special test help -t, --touch[x,y] touch event -c, --count total count of test -i, --interval interval -S, --swap[option] swap event option is -s| -e| -b -s, --start: the start point of swap -e, --end: the end point of swap -b, --bilateral: swap go and back -k, --spec_insomnia power on/off event -T, --time total time of test -C, --component component event -p, --screenshot get screenshot(only in componment input) -r, --record record user operation -R, --replay replay user operation -u, --uitest uitest dumpLayout
-
Wukong exec 随机测试,具体命令如下:
# wukong exec -h usage: wukong exec [<arguments>] These are wukong exec arguments list: -h, --help random test help -a, --appswitch appswitch event percent -b, --bundle the bundle name of allowlist -p, --prohibit the bundle name of blocklist -d, --page block page list -t, --touch touch event percent -c, --count test count -i, --interval interval -s, --seed random seed -m, --mouse mouse event percent -k, --keyboard keyboard event percent -H, --hardkey hardkey event percent -S, --swap swap event percent -T, --time test time -C, --component component event percent -r, --rotate rotate event percent -e, --allow ability the ability name of allowlist -E, --block ability the ability name of blocklist -I, --screenshot get screenshot(only in random input)
-
Wukong focus 专注测试,具体命令如下:
# wukong focus -h usage: wukong focus [<arguments>] These are wukong focus arguments list: -h, --help random test help -a, --appswitch appswitch event percent -b, --bundle the bundle name of allowlist -p, --prohibit the bundle name of blocklist -t, --touch touch event percent -c, --count test count -i, --interval interval -s, --seed random seed -m, --mouse mouse event percent -k, --keyboard keyboard event percent -H, --hardkey hardkey event percent -S, --swap swap event percent -T, --time test time -C, --component component event percent -r, --rotate rotate event percent -n, --numberfocus the number of inputs to focus on some component one time -f, --focustypes the component type to focus on
-
Wukong appinfo 查询可以测试的app信息,具体如下:
# wukong appinfo -h BundleName: com.ohos.adminprovisioning AbilityName: com.ohos.adminprovisioning.MainAbility BundleName: com.ohos.callui AbilityName: com.ohos.callui.MainAbility BundleName: com.ohos.camera AbilityName: com.ohos.camera.MainAbility BundleName: com.ohos.contacts AbilityName: com.ohos.contacts.MainAbility BundleName: com.ohos.mms AbilityName: com.ohos.mms.MainAbility BundleName: com.ohos.note AbilityName: MainAbility BundleName: com.ohos.photos AbilityName: com.ohos.photos.MainAbility BundleName: com.ohos.settings AbilityName: com.ohos.settings.MainAbility BundleName: com.ohos.smartperf AbilityName: MainAbility BundleName: com.ohos.updateapp AbilityName: com.ohos.updateapp.MainAbility BundleName: ohos.samples.distributedcalc AbilityName: MainAbility BundleName: ohos.samples.distributedmusicplayer AbilityName: ohos.samples.distributedmusicplayer.MainAbility BundleName: ohos.samples.etsclock AbilityName: MainAbility
问题
-
控制台命令不太友好,所以利用业余时间写了个带界面的wukong工具
这个是测试界面,可以进行应用随机,系统随机,专项测试和查看测试日志
这是个小工具,可以获取屏幕投屏,能操作板子
目前这个小工具仓地址为:https://gitee.com/wshixjr/elec_wukong ,在 https://gitee.com/wshixjr/elec_wukong/tree/master/src/out , 这个路径下exe安装包可以下载直接使用,有问题直接issue
小结
这个工具刚开发出来,目前有这么几处问题:
- 只测过usb连接,如果网络连接没有测试过;
- 压测时间长了,可能会有问题,比如断连啥的就没有实时数据了;
- 设备控制是通过截屏来的,自己不会刷新,后面需要看看ohos能提供什么接口,不行就得魔改hdc了,哈哈;
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
分类
已于2023-12-14 10:19:40修改
赞
2
收藏 1
回复
相关推荐
自己写了个带界面的工具可太秀了,必须学习下
大咖好,我在跑wukong的时候也遇到过几次the device is disconnected,不知道什么原因
设备断连,hdc断了?
能测安卓/苹果机吗?
或者业内有能测安卓和苹果机的好工具吗?