mirror of
https://github.com/openharmony/wukong.git
synced 2026-06-30 22:07:58 -04:00
@@ -1,62 +1,56 @@
|
||||
# WuKong
|
||||
|
||||
## Introduction
|
||||
## One、Introduction
|
||||
|
||||
OpenHarmony stability testing automation tool simulates disorderly user behavior to stress test the stability of OpenHarmony systems and applications.
|
||||
|
||||
## Supported features
|
||||
## Two、code directory
|
||||
|
||||
> The current version supports the following functions, and the expansion capacity is planned for continuous developing in the future.
|
||||
|
||||
- Support RK3568, Hi3516
|
||||
- Support shell startup
|
||||
- Support whole machine application pull up
|
||||
- Support set random seeds, pull up by fixed random sequence
|
||||
- Support setting app pull-up interval, default 1000ms
|
||||
- Support setting the number of app pulls, the default number of times is 10 times
|
||||
- Support query application to pull up bundle name, ability name
|
||||
- Support injecting random events
|
||||
- Touch event injection
|
||||
- Swap event injection
|
||||
- Mouse event injection
|
||||
- Keyboard event injection
|
||||
- Hardkey event injection
|
||||
- Support wukong run log printing
|
||||
- Support sleep wake-up special test
|
||||
- Support app whitelisting
|
||||
- Support app blacklist
|
||||
|
||||
---
|
||||
|
||||
## How to use?
|
||||
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
```
|
||||
├── wukong # Wukong main code file
|
||||
| └── common # Provides application control capabilities, random event injection capabilities, multi-mode event injection capabilities
|
||||
| └── component_event # Define the ability, page, Component tree to provide the ability to add nodes, traverse the tree, find child nodes by NodeId, etc
|
||||
| └── input_factory # Realize the screen click, slide, drag, keyboard and other events injection ability
|
||||
| └── report # Monitor abnormal information, collect, collect statistics, and display it
|
||||
| └── shell_command # Used to create a command line map, parse the command line parameters, and execute the command line
|
||||
| └── test_flow
|
||||
│ └── include # Defining Header files
|
||||
│ └── src
|
||||
│ ├── random_test_flow.cpp # Inherited from TestFlow, is the execution flow of random tests
|
||||
│ ├── special_test_flow.cpp # Inherited from TestFlow, is the execution flow of sequential specific tests
|
||||
│ ├── test_flow.cpp # Check whether the command line parameters conform to specifications
|
||||
│ ── BUILD.gn # Store the configuration of WUkong construction, including construction object, method, dependency, hardware architecture, and file format
|
||||
│ ── README_zh.md # The readme file
|
||||
```
|
||||
|
||||
```bash
|
||||
> hdc_std shell wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
## Third、constraints
|
||||
|
||||
1、WuKong was prefabricated for use after system version 3.2
|
||||
2、Versions of WuKong prior to version 3.2 do not compile with the version. When using WuKong, you need to compile and push it to the stabbed OpenHarmony device. The steps are as follows:
|
||||
```
|
||||
2.1、Build a way
|
||||
./build.sh --product-name rk3568 --build-target wukong
|
||||
2.2、push
|
||||
hdc_std shell mount -o rw,remount /
|
||||
hdc_std file send wukong /
|
||||
hdc_std shell chmod a+x /wukong
|
||||
hdc_std shell mv /wukong /bin/
|
||||
```
|
||||
|
||||
`wukong exec` is the main command, the `-s` parameter sets the random seed, and 10 is the seed value; `-i` sets application pull interval, 1500 units ms, -c parameter sets number of executions.
|
||||
## Four、functional characteristics
|
||||
|
||||
---
|
||||
### Function Features and Command Description
|
||||
|
||||
## Command Description
|
||||
|
||||
| Command | Description | Note |
|
||||
| -------------- | ---------------------------------------------- | ------------- |
|
||||
| wukong version | Get wukong version information | -v, --version |
|
||||
| wukong help | Get wukong help information | -h, --help |
|
||||
| wukong help | Get wukong help information | |
|
||||
| wukong appinfo | Query support pulling up the application enterName and the corresponding mainAbility name | |
|
||||
| wukong special | wukong special test | |
|
||||
| wukong exec | wukong randomly tests | |
|
||||
|
||||
----
|
||||
|
||||
## Command option description
|
||||
|
||||
### wukong special description
|
||||
|
||||
| Command | Features | Required | Note |
|
||||
@@ -73,6 +67,13 @@ OpenHarmony stability testing automation tool simulates disorderly user behavior
|
||||
| -T, --time | Set the total test time | No | Unit minutes, the default is 10 minutes |
|
||||
| -C, --component | The control sequentially traverses the test | No | You need to set the test app name |
|
||||
|
||||
#### Example of Wukong Special test
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong special -C [bundlename] -p
|
||||
```
|
||||
special test:wukong special main command. -C control iterates the test parameters in sequence. bundlename is the name of the test application. -p indicates the screenshot
|
||||
|
||||
### wukong random description
|
||||
|
||||
| Command | Features | Required | Note |
|
||||
@@ -94,23 +95,19 @@ OpenHarmony stability testing automation tool simulates disorderly user behavior
|
||||
|
||||
> Note: Configuring the same random seed results in the same sequence of random events
|
||||
|
||||
#### Example of Wukong Special random test
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
```
|
||||
Random test: wukong exec main command, -s parameter set random seed, 10 is the seed value; -i Specifies the application pull up interval, 1000 unit ms. -a Indicates the application random pull up test ratio of 28%. -t sets the proportion of random touch tests to 72%. -c Specifies the execution times to 100
|
||||
---
|
||||
|
||||
## Push wukong to the device
|
||||
## Five、Release Version releaseNote
|
||||
|
||||
> Stability test automation tool wukong is not compiled with the version for the time being, and it needs to be compiled by itself and pushed to the OpenHarmony device under test.
|
||||
|
||||
### Build
|
||||
|
||||
```
|
||||
./build.sh --product-name rk3568 --build-target wukong
|
||||
```
|
||||
|
||||
### Push
|
||||
|
||||
```
|
||||
hdc_std shell mount -o rw,remount /
|
||||
hdc_std file send wukong /
|
||||
hdc_std shell chmod a+x /wukong
|
||||
hdc_std shell mv /wukong /bin/
|
||||
```
|
||||
1、3.2.0.0 version
|
||||
> Content of the release:Pre-made Wukong supports the following functions
|
||||
> 1、Support collecting app pull up, setting random seed, setting app pull up interval, setting app pull up times, and querying app pull up bundle name and ability name;
|
||||
> 2、Support random injection of events, support random injection of controls, support sleep and wake up special tests, support control sequence traversal screenshots special tests;
|
||||
> 3、Supports WUkong run log printing
|
||||
> 4、White and blacklist applications are supported
|
||||
+55
-57
@@ -1,62 +1,55 @@
|
||||
# WuKong部件
|
||||
## 工具介绍
|
||||
## 一、简介
|
||||
|
||||
OpenHarmony稳定性测试自动化工具,通过模拟无序的用户行为,对OpenHarmony系统及应用进行稳定性压力测试。
|
||||
OpenHarmony稳定性测试自动化工具,通过模拟用户行为,对OpenHarmony系统及应用进行稳定性压力测试。
|
||||
|
||||
## 支持功能
|
||||
## 二、代码目录
|
||||
|
||||
> 当前版本支持如下功能,扩展能力后续规划持续改进
|
||||
|
||||
- 支持RK3568、Hi3516
|
||||
- 支持Shell启动
|
||||
- 支持整机应用拉起
|
||||
- 支持设置随机种子,按固定随机序列拉起
|
||||
- 支持设置应用拉起间隔,默认1000ms
|
||||
- 支持设置应用拉起次数,默认次数10次
|
||||
- 支持查询应用拉起bundle名、ability名
|
||||
- 支持注入随机事件
|
||||
- Touch事件注入
|
||||
- Swap事件注入
|
||||
- Mouse事件注入
|
||||
- Keyboard事件注入
|
||||
- Hardkey事件注入
|
||||
- 支持wukong运行日志打印
|
||||
- 支持休眠唤醒专项测试
|
||||
- 支持录制回放专项测试
|
||||
- 支持应用白名单
|
||||
- 支持应用黑名单
|
||||
- 支持控件顺序遍历截图专项测试
|
||||
---
|
||||
|
||||
## 使用方式
|
||||
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
```
|
||||
├── wukong # wukong主要代码文件
|
||||
| └── common # 提供应用管控能力,随机事件注入能力,多模事件注入能力
|
||||
| └── component_event # 定义ability、page、Component树,提供添加节点、遍历树、依据NodeId查找子节点等能力
|
||||
| └── input_factory # 实现屏幕点击、滑动、拖拽、键盘等事件注入能力
|
||||
| └── report # 监听异常信息,对其进行收集、统计、显示功能
|
||||
| └── shell_command # 用来创建命令行map,解析命令行参数并执行命令行
|
||||
| └── test_flow
|
||||
│ └── include # 定义头文件
|
||||
│ └── src
|
||||
│ ├── random_test_flow.cpp # 继承TestFlow,是随机测试的执行流
|
||||
│ ├── special_test_flow.cpp # 继承TestFlow,是顺序专项测试的执行流
|
||||
│ ├── test_flow.cpp # 检查命令行参数是否符合规范
|
||||
│ ── BUILD.gn # 存放wukong构建的配置,具体包括构建对象、方式、依赖、硬件架构、文件格式
|
||||
│ ── README_zh.md # readme文件
|
||||
```
|
||||
|
||||
```bash
|
||||
> hdc_std shell wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
## 三、约束条件
|
||||
|
||||
1、WuKong在3.2系统版本后开始预制使用。
|
||||
2、WuKong在3.2系统版本之前的版本不随版本编译,使用时需自行编译后推送至被刺OpenHarmony设备,步骤如下:
|
||||
```
|
||||
2.1、构建方式
|
||||
./build.sh --product-name rk3568 --build-target wukong
|
||||
2.2、推送方式
|
||||
hdc_std shell mount -o rw,remount /
|
||||
hdc_std file send wukong /
|
||||
hdc_std shell chmod a+x /wukong
|
||||
hdc_std shell mv /wukong /bin/
|
||||
```
|
||||
|
||||
wukong exec 为主命令,-s 参数设置随机种子,10为种子值;-i 参数设置应用拉起间隔,1500单位ms,-c 参数设置执行次数
|
||||
|
||||
---
|
||||
|
||||
## 命令说明
|
||||
## 四、功能特性
|
||||
|
||||
### 功能特性及命令说明
|
||||
|
||||
|
||||
| 命令 | 说明 | 备注 |
|
||||
| -------------- | ---------------------------------------------- | ------------- |
|
||||
| version | 获取wukong版本信息 | -v, --version |
|
||||
| help | 获取wukong帮助信息 | --help |
|
||||
| help | 获取wukong帮助信息 | |
|
||||
| appinfo | 查询支持拉起应用entryName和对应的mainAbility名 | |
|
||||
| special | 悟空专项测试 | |
|
||||
| exec | 悟空随机测试 | |
|
||||
|
||||
----
|
||||
## 命令选项描述
|
||||
|
||||
### wukong special描述
|
||||
|
||||
@@ -76,6 +69,14 @@ wukong exec 为主命令,-s 参数设置随机种子,10为种子值;-i 参
|
||||
| -r, --record | 录制 | 否 | 需要指定录制文件 |
|
||||
| -R, --replay | 回放 | 否 | 需要指定回放文件 |
|
||||
| -p, --screenshot | 控件测试截图 | 否 | - |
|
||||
|
||||
#### wukong special专项测试使用示例
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong special -C [bundlename] -p
|
||||
```
|
||||
专项测试:wukong special 为主命令,-C 控件顺序遍历测试参数设置,bundlename为测试应用名称;-p 表示截图
|
||||
|
||||
### wukong random描述
|
||||
|
||||
| 命令 | 功能 | 必选 | 备注 |
|
||||
@@ -97,23 +98,20 @@ wukong exec 为主命令,-s 参数设置随机种子,10为种子值;-i 参
|
||||
|
||||
> 备注:配置相同随机种子,会生成相同随机事件序列
|
||||
|
||||
#### wukong special随机测试使用示例
|
||||
```bash
|
||||
> hdc_std shell
|
||||
# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
|
||||
```
|
||||
随机测试:wukong exec 为主命令,-s 参数设置随机种子,10为种子值;-i 参数设置应用拉起间隔,1000单位ms; -a 参数设置应用随机拉起测试比例28%; -t 参数设置屏幕随机touch测试比例为72%; -c 参数设置执行次数为100次
|
||||
|
||||
---
|
||||
|
||||
## 推送wukong至设备
|
||||
## 五、发布版本releaseNote说明
|
||||
|
||||
> 稳定性测试自动化工具wukong暂时不随版本编译,使用时需自行编译后推送至被测OpenHarmony设备
|
||||
|
||||
### 构建方式
|
||||
|
||||
```
|
||||
./build.sh --product-name rk3568 --build-target wukong
|
||||
```
|
||||
|
||||
### 推送方式
|
||||
|
||||
```
|
||||
hdc_std shell mount -o rw,remount /
|
||||
hdc_std file send wukong /
|
||||
hdc_std shell chmod a+x /wukong
|
||||
hdc_std shell mv /wukong /bin/
|
||||
```
|
||||
1、3.2.0.0版本
|
||||
> 发布内容:预制wukong应用,支持以下功能
|
||||
> 1、支持征集应用拉起、设置随机种子、设置应用拉起间隔、设置应用拉起次数、支持查询应用拉起bundle名和ability名;
|
||||
> 2、支持随机注入事件、支持随机注入控件、支持休眠唤醒专项测试、支持控件顺序遍历截图专项测试;
|
||||
> 3、支持wukong运行日志打印
|
||||
> 4、支持应用白、黑名单
|
||||
@@ -35,7 +35,7 @@ namespace WuKong {
|
||||
namespace {
|
||||
const std::string WUKONG_TOOL_NAME = "wukong";
|
||||
|
||||
const std::string WUKONG_TOOL_VERSION = "version: 1.1.0\n";
|
||||
const std::string WUKONG_TOOL_VERSION = "version: 3.2.0.0\n";
|
||||
|
||||
const std::string ACE_ENABLE = "param set persist.ace.testmode.enabled 1";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user