未验证 提交 69bc6796 编写于 作者: O openharmony_ci 提交者: Gitee

!14914 翻译完成 14073

Merge pull request !14914 from ester.zhou/TR-14073
...@@ -48,7 +48,7 @@ arkXtest is divided into two parts: unit test framework and UI test framework. ...@@ -48,7 +48,7 @@ arkXtest is divided into two parts: unit test framework and UI test framework.
Software for writing test scripts: DevEco Studio 3.0 or later Software for writing test scripts: DevEco Studio 3.0 or later
Hardware for running test scripts: PC connected to a OpenHarmony device, such as the RK3568 development board Hardware for running test scripts: PC connected to an OpenHarmony device, such as the RK3568 development board
### Setting Up the Environment ### Setting Up the Environment
...@@ -63,8 +63,8 @@ Hardware for running test scripts: PC connected to a OpenHarmony device, such as ...@@ -63,8 +63,8 @@ Hardware for running test scripts: PC connected to a OpenHarmony device, such as
## Writing a Unit Test Script ## Writing a Unit Test Script
```TS ```TS
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
const delegator = abilityDelegatorRegistry.getAbilityDelegator() const delegator = abilityDelegatorRegistry.getAbilityDelegator()
export default function abilityTest() { export default function abilityTest() {
...@@ -197,11 +197,12 @@ The framework supports multiple test case execution modes, which are triggered b ...@@ -197,11 +197,12 @@ The framework supports multiple test case execution modes, which are triggered b
| breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true | | breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true |
| testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function | | testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function |
| level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 | | level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 |
| size | Size of the test case to be executed. | small, medium, large | -s size small | | size | Size of the test case to be executed. | small, medium, large | -s size small |
| stress | Number of times that the test case is executed. | Positive integer | -s stress 1000 |
**Running Commands** **Running Commands**
Configure hdc-related environment variables, and then perform the following: > Configure hdc-related environment variables, and then perform the following:
- Open the CLI. - Open the CLI.
- Run the **aa test** commands. - Run the **aa test** commands.
...@@ -260,12 +261,18 @@ Example 9: Execute test cases at the specified level. ...@@ -260,12 +261,18 @@ Example 9: Execute test cases at the specified level.
hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s level 0 hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s level 0
``` ```
Example 10: Execute test cases with the specified level. Example 10: Execute test cases with the specified size.
```shell ```shell
hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s size small hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s size small
``` ```
Example 11: Execute test cases for a specified number of times.
```shell
hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s stress 1000
```
**Viewing the Test Result** **Viewing the Test Result**
- During test execution in the CLI, the log information similar to the following is displayed: - During test execution in the CLI, the log information similar to the following is displayed:
...@@ -394,11 +401,11 @@ Run the following command, restart the device, and execute the test case again: ...@@ -394,11 +401,11 @@ Run the following command, restart the device, and execute the test case again:
hdc shell param set persist.ace.testmode.enabled 1 hdc shell param set persist.ace.testmode.enabled 1
``` ```
#### The failure log contains "uitest-api dose not allow calling concurrently" #### The failure log contains "uitest-api does not allow calling concurrently"
**Problem** **Problem**
The UI test case fails to be executed. The HiLog file contains the error message "uitest-api dose not allow calling concurrently". The UI test case fails to be executed. The HiLog file contains the error message "uitest-api does not allow calling concurrently".
**Possible Causes** **Possible Causes**
...@@ -412,11 +419,11 @@ The UI test case fails to be executed. The HiLog file contains the error message ...@@ -412,11 +419,11 @@ The UI test case fails to be executed. The HiLog file contains the error message
2. Do not execute UI test cases in multiple processes. 2. Do not execute UI test cases in multiple processes.
#### The failure log contains "dose not exist on current UI! Check if the UI has changed after you got the widget object" #### The failure log contains "does not exist on current UI! Check if the UI has changed after you got the widget object"
**Problem** **Problem**
The UI test case fails to be executed. The HiLog file contains the error message "dose not exist on current UI! Check if the UI has changed after you got the widget object". The UI test case fails to be executed. The HiLog file contains the error message "does not exist on current UI! Check if the UI has changed after you got the widget object".
**Possible Causes** **Possible Causes**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册