1# wukong User Guide 2 3 4## Overview 5 6Stability testing is important in that it demonstrates how an application performs under stress. For this reason, wukong, a stability testing tool specially designed for OpenHarmony developers, is provided. 7 8In this document you will learn about the key functions of wukong and how to use it to perform stability testing. 9 10## Introduction 11 12wukong is part of the OpenHarmony toolkit and implements basic application stability test capabilities such as random event injection, component injection, exception capture, report generation, and data traversal of abilities. 13 14## Principles 15 16wukong mainly provides two types of tests: random test and special test. 17 18- Random test 19 20 The random test is the staple service of wukong. It provides the basic startup, running, and result summary features, as shown below. 21 22 ![](figures/wukongRandomTest.png) 23 24 The following figure shows the basic running process of the random test, which depends on the **hdc** command. 25 26 ![](figures/wukongRandomTestFlow.png) 27 28- Special test 29 30 The special test provides a wide range of features: traversing the components of an application in sequence, recording and playback, and sleeping and waking up. 31 32 The following figure shows the main features of the special test. 33 34 ![](figures/wukongSpecialTest.png) 35 36For details about the test commands, see [wukong](https://gitee.com/openharmony/ostest_wukong/blob/master/README.md). 37 38## Constraints 39 401. wukong is pre-installed in version 3.2 and later versions. 41 422. In versions earlier than 3.2, you must build wukong separately and push it to the tested OpenHarmony device. The procedure is as follows: 43 How to build: 44 ``` 45 ./build.sh --product-name rk3568 --build-target wukong 46 ``` 47 How to push: 48 ``` 49 hdc_std shell mount -o rw,remount / 50 hdc_std file send wukong / 51 hdc_std shell chmod a+x /wukong 52 hdc_std shell mv /wukong /bin/ 53 ``` 54 55## Environment Preparations 56 57To run commands, connect the PC to an OpenHarmony device, such as the RK3568 development board. 58 59## Performing Stability Testing 60 61**Using wukong exec for Random Test** 62 63Access the shell and run the following random test command: 64``` 65# wukong exec -s 10 -i 1000 -a 0.28 -t 0.72 -c 100 66``` 67Random test commands 68| Command | Value | Description | 69| -------------- | -------------- | ---------------------------------------------- | 70| wukong exec | - | Works as the main command. | 71| -s | 10 | Sets the random seed. The value 10 is the seed value. | 72| -i | 1000 | Sets the application startup interval to 1000 ms.| 73| -a | 0.28 | Sets the proportion of the random application startup test to 28%. | 74| -t | 0.72 | Sets the proportion of the random touch test to 72%. | 75| -c | 100 | Sets the number of execution times to 100. | 76 77**Using wukong special for Special Test** 78 79Access the shell and run the following commands to perform the sequential traversal test: 80```bash 81# wukong special -C [bundlename] -p 82``` 83Special test commands 84| Command | Value | Description | 85| -------------- |-------------- | ---------------------------------------------- | 86| wukong special | - | Works as the main command. | 87| -C [bundlename] |[bundlename] | Sets the bundle name of the application for the sequential traversal test. | 88| -p | - | Indicates a screenshot. | 89 90## Viewing the Test Result 91 92After the test commands are executed, the test result is automatically generated. 93 94You can obtain the test result in the following directory: 95``` 96Before 2022/9/22: /data/local/wukong/report/xxxxxxxx_xxxxxx/ 97Since 2022/9/22: /data/local/tmp/wukong/report/xxxxxxxx_xxxxxx/ 98``` 99>**NOTE** 100> 101>The folder for test reports is automatically generated. 102 103Content of the folder is described in the table below. 104| Folder/File | Description | 105| ------------------------------------ | ------------------ | 106| exception/ | Stores exception files generated during the test.| 107| screenshot/ | Stores screenshots of the sequential traversal test. | 108| wukong_report.csv | Stores the test report summary. | 109 110You can view the wukong execution log in the path below: 111``` 112reports/xxxxxxxx_xxxxxx/wukong.log 113``` 114