• Home
Name Date Size #Lines LOC

..--

common/12-May-2024-2,2761,552

component_event/12-May-2024-2,0571,406

figures/12-May-2024-

input_factory/12-May-2024-1,7271,174

report/12-May-2024-3,1602,086

shell_command/12-May-2024-519373

test_flow/12-May-2024-1,4681,035

BUILD.gnD12-May-20245.5 KiB141130

LICENSED12-May-20249.9 KiB177150

OAT.xmlD12-May-20243.8 KiB6112

README.mdD12-May-20248.7 KiB136115

README_zh.mdD12-May-20248.8 KiB139118

bundle.jsonD12-May-20241 KiB5049

README.md

1# wukong
2## Introduction
3
4OpenHarmony stability testing automation tool simulates disorderly user behavior to stress test the stability of OpenHarmony systems and applications.<br>
5
6wukong component architecture diagram<br>
7![架构图](figures/wukongArchitectureDiagram.png)<br>
8
9Submodule responsibilities within the component:<br>
101. Command line parsing: allows you to obtain and parse parameters on the command line.<br>
112. Running environment management: Initialize the overall wukong running environment according to the command line.<br>
123. System interface management: Check and get the specified mgr, register controller and dfx faultlog callback functions.<br>
134. Random event generation: Generate a random sequence with a specified number of seeds through the random function to generate events.<br>
145. Event injection: Inject events into the system based on supported event types, relying on subsystems such as Windows, multimode, and security.<br>
156. Exception capture and processing/report generation: The DFX subsystem obtains anomaly information in operation and records logs to generate reports.<br>
16
17## Directory
18
19```
20├── wukong                              # wukong main code file
21|   └── common                          # Provides application control capabilities, random event injection capabilities, multi-mode event injection capabilities
22|   └── component_event                 # Define the ability, page, Component tree to provide the ability to add nodes, traverse the tree, find child nodes by NodeId, etc
23|   └── input_factory                   # Realize the screen click, slide, drag, keyboard and other events injection ability
24|   └── report                          # Monitor abnormal information, collect, collect statistics, and display it
25|   └── shell_command                   # Used to create a command line map, parse the command line parameters, and execute the command line
26|   └── test_flow
27│       └── include                     # Defining Header files
28│       └── src
29│           ├── random_test_flow.cpp    # Inherited from TestFlow, is the execution flow of random tests
30│           ├── special_test_flow.cpp   # Inherited from TestFlow, is the execution flow of sequential specific tests
31│           ├── test_flow.cpp           # Check whether the command line parameters conform to specifications
32│   ── BUILD.gn                         # Store the configuration of wukong construction, including construction object, method, dependency, hardware architecture, and file format
33│   ── README_zh.md                     # The readme file
34```
35
36## Constraints
37
381. wukong began presetting after system version 3.2<br>
392. 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 OpenHarmony device under test. The procedure is as follows:<br>
40    2.1. Build a way
41    ```
42    ./build.sh --product-name rk3568 --build-target wukong
43    ```
44    2.2. push
45    ```
46    hdc_std shell mount -o rw,remount /
47    hdc_std file send wukong /
48    hdc_std shell chmod a+x /wukong
49    hdc_std shell mv /wukong /bin/
50    ```
51
52## Directions for use
53
54### Function Features and Command Description
55
56
57| Command | Description | Note |
58| -------------- | ---------------------------------------------- | ------------- |
59| wukong version | Get wukong version information | -v, --version |
60| wukong help    | Get wukong help information |               |
61| wukong appinfo | Query support pulling up the application bundleName and the corresponding mainAbility name |               |
62| wukong special | wukong special test |               |
63| wukong exec    | wukong randomly tests |               |
64
65
66### wukong special description
67
68| Command | Features | Required | Note |
69| :------------------ | ---------------------- | ---- | :------------------ |
70| -h, --help          | Get help information for the current test. | No | Specialized test help information. |
71| -k, --spec_insomnia | Sleep wake-up special test. | No | -                   |
72| -c, --count         | Set the Number of executions. | No | The default is 10 times. |
73| -i, --interval      | Set the execution interval. | No | Unit ms, default 1500ms. |
74| -S, --swap          | Sliding test. | No | -                   |
75| -s, --start[x,y]    | Set the slide test start coordinates. | No | -                   |
76| -e, --end[x,y]      | Set the slide test end coordinates. | No | -                   |
77| -b, --bilateral     | Set the round-trip swipe. | No | By default, there is no round-trip swipe. |
78| -t, --touch[x,y]    | Click test. | No | -                   |
79| -T, --time          | Set the total test time. | No | Unit minutes, the default is 10 minutes. |
80| -C, --component     | The control sequentially traverses the test. | No | You need to set the test app name. |
81
82#### Example of wukong Special test
83```bash
84> hdc_std shell
85# wukong special -C [bundlename] -p
86```
87Specific test example parsing:
88| Command           | Parameter Value     | Description                                           |
89| -------------- | -------------- | ---------------------------------------------- |
90| wukong special |  | The main commands.                             |
91| -C [bundlename] |[bundlename]| Control to sequentially traverse the test parameter Settings, bundlename is the name of the test application.    |
92| -p | | Represents a screenshot.                             |
93
94### wukong random description
95
96| Command | Features | Required | Note |
97| --------------- | ------------------------------------ | ---- | ---------------------------------------- |
98| -h,--help       | Get help information for the current test. | No | Random test help information. |
99| -c,--count      | Set the Number of executions, conflicts with -T. | No | The number of units, the default is 10 times. |
100| -i,--interval   | Set the execution interval. | No | Unit ms, default 1500ms. |
101| -s,--seed       | Set the Random Seed. | No | Configuring the same random seed results in the same random event sequence. |
102| -b,--bundle[bundlename,......,bundlename]     | Set the list of allowed applications for this test, and the -p conflict. | No | By default, test all apps for the current device (app names separated by commas). |
103| -p,--prohibit[bundlename,......,bundlename]   | Set the list of prohibited apps for this test, which conflicts with -b. | No | By default, no applications are prohibited (application names are separated by commas). |
104| -a,--appswitch  | Set the app random pull-up test scale. | No | The default 10%. |
105| -t,--touch      | Set the screen random touch test ratio. | No | The default 10%. |
106| -S,--swap       | Set the screen random swap test scale. | No | The default 3%. |
107| -m,--mouse      | Set the screen randommou test ratio. | No | The default 1%. |
108| -k,--keyboard   | Set the screen random keyboard test ratio. | No | The default 2%. |
109| -H,--hardkey    | Set the random hardkey test scale. | No | The default 4%. |
110| -C, --component | Set the Random Control Test Scale. | No | The default 70%. |
111| -T,--time       | Set the total test time, conflicts with -c. | No | Unit minutes, the default is 10 minutes. |
112
113> Instructions: Configuring the same random seed results in the same sequence of random events
114
115#### Example of wukong exec random test
116```bash
117> hdc_std shell
118# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
119```
120Random test example parsing:
121| Command           | Parameter Value     | Description                                           |
122| -------------- | --------------     | ---------------------------------------------- |
123| wukong exec |       | The main command.                             |
124| -s  | 10    | Parameter set random seed, 10 is the seed value.           |
125| -i  | 1000   | Parameter Settings apply pull up interval, 1000 unit ms. |
126| -a  | 0.28   | Parameter Settings Apply random pull up test ratio 28%.         |
127| -t  | 0.72   | Parameter Settings Screen random touch test proportion is 72%.    |
128| -c  | 100  | Parameter Setting The number of execution times is 100.                |
129
130## Release notes
131
1323.2.0.0 Release content: Preset wukong supports the following functions:<br>
1331. Support the whole machine application pull up, set the random seed, set the application pull up interval, set the application pull up times, support the query application pull up bundle name and ability name.<br>
1342. Support random injection of events, support random injection of controls, support sleep and wake up special tests, support control sequence traversal screenshots special tests.<br>
1353. Supports wukong run log printing.<br>
1364. White and blacklist applications are supported.

README_zh.md

1# wukong部件
2## 简介
3
4OpenHarmony稳定性测试自动化工具,通过模拟用户行为,对OpenHarmony系统及应用进行稳定性压力测试。<br>
5
6wukong部件架构图<br>
7![架构图](figures/wukong部件架构图.png)<br>
8
9部件内子模块职责:<br>
101. 命令行解析:支持命令行获取参数并解析命令行参数。<br>
112. 运行环境管理:根据命令行初始化wukong整体运行环境。<br>
123. 系统接口管理:检查并获取指定的mgr,注册controller和dfx的faultlog的回调函数。<br>
134. 随机事件生成:通过random函数生成指定种子数的随机序列,生成事件。<br>
145. 事件注入:根据支持的事件类型向系统注入事件,依赖窗口、多模、安全等子系统。<br>
156. 异常捕获处理/报告生成:通过DFX子系统获取运行中的异常信息并记录log,生成报告。<br>
16
17## 目录
18
19```
20├── wukong                              # wukong主要代码文件
21|   └── common                          # 提供应用管控能力,随机事件注入能力,多模事件注入能力
22|   └── component_event                 # 定义ability、page、Component树,提供添加节点、遍历树、依据NodeId查找子节点等能力
23|   └── input_factory                   # 实现屏幕点击、滑动、拖拽、键盘等事件注入能力
24|   └── report                          # 监听异常信息,对其进行收集、统计、显示功能
25|   └── shell_command                   # 用来创建命令行map,解析命令行参数并执行命令行
26|   └── test_flow
27│       └── include                     # 定义头文件
28│       └── src
29│           ├── random_test_flow.cpp    # 继承TestFlow,是随机测试的执行流
30│           ├── special_test_flow.cpp   # 继承TestFlow,是顺序专项测试的执行流
31│           ├── test_flow.cpp           # 检查命令行参数是否符合规范
32│   ── BUILD.gn                         # 存放wukong构建的配置,具体包括构建对象、方式、依赖、硬件架构、文件格式
33│   ── README_zh.md                     # readme文件
34```
35
36## 约束
37
381. wukong在3.2系统版本后开始预置使用。<br>
392. wukong在3.2系统版本之前的版本不随版本编译,使用时需自行编译后推送至被测OpenHarmony设备,步骤如下:
40    2.1. 构建方式
41    ```
42    ./build.sh --product-name rk3568 --build-target wukong
43    ```
44    2.2. 推送方式
45    ```
46    hdc_std shell mount -o rw,remount /
47    hdc_std file send wukong /
48    hdc_std shell chmod a+x /wukong
49    hdc_std shell mv /wukong /bin/
50    ```
51
52## 使用说明
53
54### 功能特性及命令说明
55
56
57| 命令           | 说明                                           | 备注          |
58| -------------- | ---------------------------------------------- | ------------- |
59| version | 获取wukong版本信息。                             | -v, --version。 |
60| help    | 获取wukong帮助信息。                             |              |
61| appinfo | 查询支持拉起应用bundleName和对应的mainAbility名。 |               |
62| special | wukong专项测试。                                   |               |
63| exec    | wukong随机测试。                                   |               |
64
65
66### wukong special描述
67
68| 命令                | 功能                   | 必选 | 备注                |
69| :------------------ | ---------------------- | ---- | :------------------ |
70| -h, --help          | 获取当前测试的帮助信息。 | 否   | 专项测试帮助信息。    |
71| -k, --spec_insomnia | 休眠唤醒专项测试。       | 否   | -                   |
72| -c, --count         | 设置执行次数。           | 否   | 默认10次。            |
73| -i, --interval      | 设置执行间隔。           | 否   | 单位ms,默认1500ms。  |
74| -S, --swap          | 滑动测试。               | 否   | -                   |
75|-s, --start[x,y]    | 设置滑动测试起点坐标。   | 否   | -                   |
76| -e, --end[x,y]      | 设置滑动测试终点坐标。   | 否   | -                   |
77| -b, --bilateral     | 设置往返滑动。           | 否   | 默认不往返滑动。      |
78| -t, --touch[x,y]    | 点击测试。               | 否   | -                   |
79| -T, --time          | 设置测试总时间。         | 否   | 单位分钟,默认10分钟。 |
80| -C, --component     | 控件顺序遍历测试。       | 否   | 需要设置测试应用名称。 |
81| -r, --record     | 录制。       | 否   | 需要指定录制文件。 |
82| -R, --replay    |  回放。      | 否   | 需要指定回放文件。 |
83| -p, --screenshot    |  控件测试截图。      | 否   | - |
84
85#### wukong special 专项测试使用示例
86```bash
87> hdc_std shell
88# wukong special -C [bundlename] -p
89```
90专项测试示例解析:
91| 命令           | 参数值           | 说明                                           |
92| -------------- |-------------- | ---------------------------------------------- |
93| wukong special |  | 主命令。                             |
94| -C [bundlename]    |[bundlename] | 控件顺序遍历测试参数设置,bundlename为测试应用名称。            |
95| -p |  | 表示截图。                             |
96
97### wukong random描述
98
99| 命令            | 功能                                 | 必选 | 备注                                     |
100| --------------- | ------------------------------------ | ---- | ---------------------------------------- |
101| -h,--help       | 获取当前测试的帮助信息。               | 否   | 随机测试帮助信息。                         |
102| -c,--count      | 设置执行次数,与-T冲突。                         | 否   | 单位次数,默认10次。                       |
103| -i,--interval   | 设置执行间隔。                         | 否   | 单位ms,默认1500ms。                       |
104| -s,--seed       | 设置随机种子。                         | 否   | 配置相同随机种子,会生成相同随机事件序列。 |
105| -b,--bundle[bundlename,……,bundlename]     | 设置本次测试的允许应用名单,与-p冲突。 | 否   | 默认测试当前设备所有应用(应用名称用逗号隔开)。                 |
106| -p,--prohibit[bundlename,……,bundlename]   | 设置本次测试的禁止应用名单,与-b冲突。 | 否   | 默认不禁止任何应用(应用名称用逗号隔开)。                       |
107| -a,--appswitch  | 设置应用随机拉起测试比例。             | 否   | 默认10%。                                  |
108| -t,--touch      | 设置屏幕随机touch测试比例。            | 否   | 默认10%。                                  |
109| -S,--swap       | 设置屏幕随机swap测试比例。             | 否   | 默认3%。                                   |
110| -m,--mouse      | 设置屏幕随机mouse测试比例。            | 否   | 默认1%。                                   |
111| -k,--keyboard   | 设置屏幕随机keyboard测试比例。         | 否   | 默认2%。                                   |
112| -H,--hardkey    | 设置随机hardkey测试比例。              | 否   | 默认4%。                                   |
113| -C, --component | 设置随机控件测试比例。                 | 否   | 默认70%。                                  |
114| -T,--time       | 设置测试总时间,与-c冲突。                       | 否   | 单位分钟,默认10分钟。                      |
115
116> 说明:配置相同随机种子,会生成相同随机事件序列
117
118#### wukong exec 随机测试使用示例
119```bash
120> hdc_std shell
121# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100
122```
123随机测试示例解析:
124| 命令           | 参数值           | 说明                                           |
125| -------------- | -------------- | ---------------------------------------------- |
126| wukong exec |           | 主命令。                             |
127| -s     | 10           | 参数设置随机种子,10为种子值。            |
128| -i  | 1000           | 参数设置应用拉起间隔,1000单位ms。 |
129| -a  | 0.28          | 参数设置应用随机拉起测试比例28%。          |
130| -t  | 0.72           | 参数设置屏幕随机touch测试比例为72%。    |
131| -c  | 100           | 参数设置执行次数为100次。                |
132
133## 版本说明
134
1353.2.0.0 版本发布内容:预置wukong,支持以下功能:<br>
1361. 支持整机应用拉起、设置随机种子、设置应用拉起间隔、设置应用拉起次数、支持查询应用拉起bundle名和ability名。<br>
1372. 支持随机注入事件、支持随机注入控件、支持休眠唤醒专项测试、支持控件顺序遍历截图专项测试。<br>
1383. 支持wukong运行日志打印。<br>
1394. 支持应用白、黑名单。