You need to sign in or sign up before continuing.
arkxtest-guidelines.md 20.9 KB
Newer Older
E
esterzhou 已提交
1 2 3 4 5
# arkXtest User Guide


## Overview

E
ester.zhou 已提交
6
arkXtest is an automated test framework that supports both the JavaScript (JS) and TypeScript (TS) programming languages. It consists of JsUnit and UiTest. 
E
esterzhou 已提交
7

E
ester.zhou 已提交
8
JsUnit is a unit test framework that provides basic APIs for compiling test cases and generating test reports for testing system and application APIs.
E
esterzhou 已提交
9

E
ester.zhou 已提交
10
UiTest is a UI test framework that provides the UI component search and operation capabilities through simple and easy-to-use APIs, and allows you to develop automated test scripts based on GUI operations. 
E
esterzhou 已提交
11

E
ester.zhou 已提交
12
This document describes the main functions, implementation principles, environment setup, and test script compilation and execution of arkXtest.
E
esterzhou 已提交
13 14


E
ester.zhou 已提交
15
## Implementation
E
esterzhou 已提交
16 17 18

arkXtest is divided into two parts: unit test framework and UI test framework.

E
ester.zhou 已提交
19 20 21 22 23
As the backbone of arkXtest, the unit test framework offers such features as identifying, scheduling, and executing test scripts, as well as summarizing test script execution results.

The UI test framework provides UiTest APIs for you to call in different test scenarios. The UI test scripts are executed on top of the unit test framework.

### Unit Test Framework
E
esterzhou 已提交
24

E
ester.zhou 已提交
25
Figure 1 Main functions of the unit test framework
E
esterzhou 已提交
26

E
ester.zhou 已提交
27
![](figures/UnitTest.PNG)
E
esterzhou 已提交
28

E
ester.zhou 已提交
29
Figure 2 Basic script process
E
esterzhou 已提交
30

E
ester.zhou 已提交
31
![](figures/TestFlow.PNG)
E
esterzhou 已提交
32

E
ester.zhou 已提交
33 34 35
> **NOTE**
>
> For details about the API in the unit test framework, see [Function Definition](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/README_en.md#how-to-use).
E
esterzhou 已提交
36

E
ester.zhou 已提交
37
### UI Test Framework
E
esterzhou 已提交
38

E
ester.zhou 已提交
39
Figure 3 Main functions of the UI test framework
E
esterzhou 已提交
40

E
ester.zhou 已提交
41
![](figures/Uitest.PNG)
E
esterzhou 已提交
42 43


E
ester.zhou 已提交
44 45 46 47
## Constraints

- The features of the UI test framework are available only in OpenHarmony 3.1 Release and later versions.

E
esterzhou 已提交
48 49 50
- The feature availability of the unit test framework varies by version. For details about the mappings between the features and versions, see [arkXtest](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/README_en.md).


E
ester.zhou 已提交
51
## Preparing the Environment
E
esterzhou 已提交
52 53 54

### Environment Requirements

E
ester.zhou 已提交
55
Software: DevEco Studio 3.0 or later
E
esterzhou 已提交
56

E
ester.zhou 已提交
57
Hardware: PC connected to an OpenHarmony device, such as the RK3568 development board
E
esterzhou 已提交
58 59 60 61 62

### Setting Up the Environment

[Download DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download) and set it up as instructed on the official website.

E
ester.zhou 已提交
63
## Creating and Compiling a Test Script
E
esterzhou 已提交
64

E
ester.zhou 已提交
65
### Creating a Test Script
E
esterzhou 已提交
66

E
ester.zhou 已提交
67
1. Open DevEco Studio and create a project, in which the **ohos** directory is where the test script is located.
E
esterzhou 已提交
68 69
2. Open the .ets file of the module to be tested in the project directory. Move the cursor to any position in the code, and then right-click and choose **Show Context Actions** > **Create Ohos Test** or press **Alt+Enter** and choose **Create Ohos Test** to create a test class.

E
ester.zhou 已提交
70 71 72 73 74 75 76 77 78 79 80
### Writing a Unit Test Script

 The unit test script must contain the following basic elements:

1. Import of the dependencies so that the dependent test APIs can be used.

2. Test code, mainly about the related logic, such as API invoking.

3. Invoking of the assertion APIs and setting of checkpoints. If there is no checkpoint, the test script is considered as incomplete.

The following sample code is used to start the test page to check whether the page displayed on the device is the expected page.
E
esterzhou 已提交
81 82

```TS
E
ester.zhou 已提交
83 84
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
E
esterzhou 已提交
85 86 87 88 89 90 91

const delegator = abilityDelegatorRegistry.getAbilityDelegator()
export default function abilityTest() {
  describe('ActsAbilityTest', function () {
    it('testUiExample',0, async function (done) {
      console.info("uitest: TestUiExample begin");
      //start tested ability
E
ester.zhou 已提交
92
      await delegator.executeShellCommand('aa start -b com.ohos.uitest -a EntryAbility').then(result =>{
E
esterzhou 已提交
93 94 95 96 97 98 99 100
        console.info('Uitest, start ability finished:' + result)
      }).catch(err => {
        console.info('Uitest, start ability failed: ' + err)
      })
      await sleep(1000);
      //check top display ability
      await delegator.getCurrentTopAbility().then((Ability)=>{
        console.info("get top ability");
E
ester.zhou 已提交
101
        expect(Ability.context.abilityInfo.name).assertEqual('EntryAbility');
E
esterzhou 已提交
102 103 104 105 106 107 108 109 110 111 112
      })
      done();
    })

    function sleep(time) {
      return new Promise((resolve) => setTimeout(resolve, time));
    }
  })
}
```

E
ester.zhou 已提交
113
### Writing a UI Test Script
E
esterzhou 已提交
114

E
ester.zhou 已提交
115
The UI test is based on the unit test. The UI test script adds the invoking of the UiTest interface (providing a link) to the unit test script to complete the corresponding test activities. In this example, the UI test script is written based on the preceding unit test script. It implements the click operation on the started application page and checks whether the page changes as expected.
E
esterzhou 已提交
116

E
ester.zhou 已提交
117
1. Import the dependency.
E
esterzhou 已提交
118 119

```js
E
ester.zhou 已提交
120
import {Driver,ON,Component,MatchPattern} from '@ohos.uitest'
E
esterzhou 已提交
121 122
```

E
ester.zhou 已提交
123
2. Write test code.
E
esterzhou 已提交
124 125 126 127 128 129 130

```js
export default function abilityTest() {
  describe('ActsAbilityTest', function () {
    it('testUiExample',0, async function (done) {
      console.info("uitest: TestUiExample begin");
      //start tested ability
E
ester.zhou 已提交
131
      await delegator.executeShellCommand('aa start -b com.ohos.uitest -a EntryAbility').then(result =>{
E
esterzhou 已提交
132 133 134 135 136
        console.info('Uitest, start ability finished:' + result)
      }).catch(err => {
        console.info('Uitest, start ability failed: ' + err)
      })
      await sleep(1000);
E
ester.zhou 已提交
137
      // Check the top display ability.
E
esterzhou 已提交
138 139
      await delegator.getCurrentTopAbility().then((Ability)=>{
        console.info("get top ability");
E
ester.zhou 已提交
140
        expect(Ability.context.abilityInfo.name).assertEqual('EntryAbility');
E
esterzhou 已提交
141
      })
E
ester.zhou 已提交
142 143
      // UI test code
      // Initialize the driver.
E
ester.zhou 已提交
144
      var driver = await Driver.create();
E
esterzhou 已提交
145
      await driver.delayMs(1000);
E
ester.zhou 已提交
146
      // Find the button on text 'Next'.
E
ester.zhou 已提交
147
      var button = await driver.findComponent(ON.text('Next'));
E
ester.zhou 已提交
148
      // Click the button.
E
esterzhou 已提交
149 150
      await button.click();
      await driver.delayMs(1000);
E
ester.zhou 已提交
151
      // Check text.
E
ester.zhou 已提交
152
      await driver.assertComponentExist(ON.text('after click'));
E
esterzhou 已提交
153 154 155 156 157 158 159 160 161 162 163 164 165
      await driver.pressBack();
      done();
    })

    function sleep(time) {
      return new Promise((resolve) => setTimeout(resolve, time));
    }
  })
}
```

## Running the Test Script

E
ester.zhou 已提交
166 167
### In DevEco Studio

E
esterzhou 已提交
168 169
You can run a test script in DevEco Studio in any of the following modes:

E
ester.zhou 已提交
170 171 172 173 174
1. Test package level: All test cases in the test package are executed.

2. Test suite level: All test cases defined in the **describe** method are executed.

3. Test method level: The specified **it** method, that is, a single test case, is executed.
E
esterzhou 已提交
175 176 177

![](figures/Execute.PNG)

E
ester.zhou 已提交
178
**Viewing the Test Result**
E
esterzhou 已提交
179 180 181 182 183

After the test is complete, you can view the test result in DevEco Studio, as shown in the following figure.

![](figures/TestResult.PNG)

E
ester.zhou 已提交
184 185 186 187
**Viewing the Test Case Coverage**

After the test is complete, you can view the test case coverage.

E
ester.zhou 已提交
188 189
### In the CLI

E
ester.zhou 已提交
190 191 192 193 194
Install the application test package on the test device and run the **aa** command with different execution control keywords in the CLI.

> **NOTE**
>
> Before running commands in the CLI, make sure hdc-related environment variables have been configured.
E
ester.zhou 已提交
195

E
ester.zhou 已提交
196
The table below lists the keywords in **aa** test commands.
E
ester.zhou 已提交
197 198 199 200 201 202 203 204 205 206

| Keyword | Abbreviation| Description                          | Example                      |
| ------------- | ------------ | -------------------------------------- | ---------------------------------- |
| --bundleName  | -b           | Application bundle name.                        | - b com.test.example               |
| --packageName | -p           | Application module name, which is applicable to applications developed in the FA model.          | - p com.test.example.entry         |
| --moduleName  | -m           | Application module name, which is applicable to applications developed in the stage model.       | -m entry                           |
| NA            | -s           | \<key, value> pair.| - s unittest OpenHarmonyTestRunner |

The framework supports multiple test case execution modes, which are triggered by the key-value pair following the **-s** keyword. The table below lists the available keys and values.

E
ester.zhou 已提交
207
| Key    | Description                                                | Value                                                | Example                             |
E
ester.zhou 已提交
208
| ------------ | -----------------------------------------------------------------------------    | ------------------------------------------------------------ | ----------------------------------------- |
E
ester.zhou 已提交
209
| unittest     | **OpenHarmonyTestRunner** object used for test case execution. | **OpenHarmonyTestRunner** or custom runner name.                 | - s unittest OpenHarmonyTestRunner        |
E
ester.zhou 已提交
210 211 212 213
| class        | Test suite or test case to be executed.                                  | {describeName}#{itName}, {describeName}                     | -s class attributeTest#testAttributeIt    |
| notClass     | Test suite or test case that does not need to be executed.                              | {describeName}#{itName}, {describeName}                     | -s notClass attributeTest#testAttributeIt |
| itName       | Test case to be executed.                                        | {itName}                                                     | -s itName testAttributeIt                 |
| timeout      | Timeout interval for executing a test case.                                       | Positive integer (unit: ms). If no value is set, the default value 5000 is used.                       | -s timeout 15000                          |
E
ester.zhou 已提交
214
| breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion failure or error occurs.| **true**/**false** (default value)                                          | -s breakOnError true                      |
E
ester.zhou 已提交
215
| random | Whether to execute test cases in random sequence.| **true**/**false** (default value)                                          | -s random true                      |
E
ester.zhou 已提交
216 217
| 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                                |
E
ester.zhou 已提交
218
| size         | Size of the test case to be executed.                                   | small, medium, large                                        | -s size small |
E
ester.zhou 已提交
219
| stress       | Number of times that the test case is executed.                                   |  Positive integer                                        | -s stress 1000                            |
E
ester.zhou 已提交
220 221 222

**Running Commands**

E
ester.zhou 已提交
223 224
1. Open the CLI.
2. Run the **aa test** commands.
E
ester.zhou 已提交
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279

Example 1: Execute all test cases.

```shell  
 hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner
```

Example 2: Execute cases in the specified test suites, separated by commas (,).

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s class s1,s2
```

Example 3: Execute specified cases in the specified test suites, separated by commas (,).

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s class testStop#stop_1,testStop1#stop_0
```

Example 4: Execute all test cases except the specified ones, separated by commas (,).

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s notClass testStop
```

Example 5: Execute specified test cases, separated by commas (,).

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s itName stop_0
```

Example 6: Set the timeout interval for executing a test case.

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner  -s timeout 15000
```

Example 7: Enable break-on-error mode.

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner   -s breakOnError true
```

Example 8: Execute test cases of the specified type.

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner   -s testType function
```

Example 9: Execute test cases at the specified level.

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner   -s level 0
```

E
ester.zhou 已提交
280
Example 10: Execute test cases with the specified size.
E
ester.zhou 已提交
281 282 283 284 285

```shell  
  hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner   -s size small
```

E
ester.zhou 已提交
286 287 288 289 290 291
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
```

E
ester.zhou 已提交
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
**Viewing the Test Result**

- During test execution in the CLI, the log information similar to the following is displayed:

```
OHOS_REPORT_STATUS: class=testStop
OHOS_REPORT_STATUS: current=1
OHOS_REPORT_STATUS: id=JS
OHOS_REPORT_STATUS: numtests=447
OHOS_REPORT_STATUS: stream=
OHOS_REPORT_STATUS: test=stop_0
OHOS_REPORT_STATUS_CODE: 1

OHOS_REPORT_STATUS: class=testStop
OHOS_REPORT_STATUS: current=1
OHOS_REPORT_STATUS: id=JS
OHOS_REPORT_STATUS: numtests=447
OHOS_REPORT_STATUS: stream=
OHOS_REPORT_STATUS: test=stop_0
OHOS_REPORT_STATUS_CODE: 0
OHOS_REPORT_STATUS: consuming=4
```

| Log Field              | Description      |
| -------           | -------------------------|
| OHOS_REPORT_SUM    | Total number of test cases in the current test suite.|
| OHOS_REPORT_STATUS: class | Name of the test suite that is being executed.|
| OHOS_REPORT_STATUS: id | Case execution language. The default value is JS. |
| OHOS_REPORT_STATUS: numtests | Total number of test cases in the test package.|
| OHOS_REPORT_STATUS: stream | Error information of the current test case.|
| OHOS_REPORT_STATUS: test| Name of the current test case.|
E
ester.zhou 已提交
323 324
| OHOS_REPORT_STATUS_CODE | Execution result of the current test case.<br>**0**: pass.<br>**1**: error.<br>**2**: fail. |
| OHOS_REPORT_STATUS: consuming | Time spent in executing the current test case, in milliseconds.|
E
ester.zhou 已提交
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341

- After the commands are executed, the log information similar to the following is displayed:

```
OHOS_REPORT_RESULT: stream=Tests run: 447, Failure: 0, Error: 1, Pass: 201, Ignore: 245
OHOS_REPORT_CODE: 0

OHOS_REPORT_RESULT: breakOnError model, Stopping whole test suite if one specific test case failed or error
OHOS_REPORT_STATUS: taskconsuming=16029

```
| Log Field              | Description          |
| ------------------| -------------------------|
| run    | Total number of test cases in the current test package.|
| Failure | Number of failed test cases.|
| Error | Number of test cases whose execution encounters errors. |
| Pass | Number of passed test cases.|
E
ester.zhou 已提交
342
| Ignore | Number of test cases not yet executed.|
E
ester.zhou 已提交
343
| taskconsuming| Total time spent in executing the current test case, in milliseconds.|
E
ester.zhou 已提交
344 345 346

> When an error occurs in break-on-error mode, check the **Ignore** and interrupt information.

E
ester.zhou 已提交
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
## Recording User Operations
### Using the Recording Feature
> You can record the operations performed on the current page to **/data/local/tmp/layout/record.csv**. To end the recording, press **Ctrl+C**.

```shell  
 hdc shell uitest uiRecord record
```
### Viewing Recording Data
You can view the recording data in either of the following ways.

#### Reading and Printing Recording Data

```shell  
 hdc shell uitest uiRecord read
```
#### Exporting the record.csv File
```shell  
hdc file recv /data/local/tmp/layout/record.csv D:\tool  # D:\tool indicates the local save path, which can be customized.
```
- The following describes the fields in the recording data:
```
{
	"ABILITY": "com.ohos.launcher.MainAbility", // Foreground application page.
	"BUNDLE": "com.ohos.launcher", // Application.
	"CENTER_X": "", // X-coordinate of the center of the pinch gesture.
	"CENTER_Y": "", // Y-coordinate of the center of the pinch gesture.
	"EVENT_TYPE": "pointer", //  
	"LENGTH": "0", // Total length.
	"OP_TYPE": "click", // Event type. Currently, click, double-click, long-press, drag, pinch, swipe, and fling types are supported.
	"VELO": "0.000000", // Hands-off velocity.
	"direction.X": "0.000000",// Movement along the x-axis.
	"direction.Y": "0.000000", // Movement along the y-axis.
	"duration": 33885000.0, // Gesture duration.
	"fingerList": [{
		"LENGTH": "0", // Total length.
		"MAX_VEL": "40000", // Maximum velocity.
		"VELO": "0.000000", // Hands-off velocity.
		"W1_BOUNDS": "{"bottom":361,"left":37,"right":118,"top":280}", // Starting component bounds.
		"W1_HIER": "ROOT,3,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0", // Starting component hierarchy.
		"W1_ID": "", // ID of the starting component.
		"W1_Text": "", // Text of the starting component.
		"W1_Type": "Image", // Type of the starting component.
		"W2_BOUNDS": "{"bottom":361,"left":37,"right":118,"top":280}", // Ending component bounds.
		"W2_HIER": "ROOT,3,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0", // Ending component hierarchy.
		"W2_ID": "", // ID of the ending component.
		"W2_Text": "", // Text of the ending component.
		"W2_Type": "Image", // Type of the ending component.
		"X2_POSI": "47", // X coordinate of the ending point.
		"X_POSI": "47", // X coordinate of the starting point.
		"Y2_POSI": "301", // Y coordinate of the ending point.
		"Y_POSI": "301", // Y coordinate of the starting point.
		"direction.X": "0.000000", // Movement along the x-axis.
		"direction.Y": "0.000000" // Movement along the y-axis.
	}],
	"fingerNumber": "1" // Number of fingers.
}
```


E
esterzhou 已提交
406 407 408 409 410 411 412 413 414 415 416 417
## FAQs

### FAQs About Unit Test Cases

#### The logs in the test case are printed after the test case result

**Problem**

The logs added to the test case are displayed after the test case execution, rather than during the test case execution.

**Possible Causes**

E
ester.zhou 已提交
418
More than one asynchronous API is called in the test case.<br>In principle, logs in the test case are printed before the test case execution is complete.
E
esterzhou 已提交
419

E
ester.zhou 已提交
420
**Solution**
E
esterzhou 已提交
421

E
ester.zhou 已提交
422
If more than one asynchronous API is called, you are advised to encapsulate the API invoking into the promise mode.
E
esterzhou 已提交
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446

#### Error "fail to start ability" is reported during test case execution

**Problem**

When a test case is executed, the console returns the error message "fail to start ability".

**Possible Causes**

An error occurs during the packaging of the test package, and the test framework dependency file is not included in the test package.

**Solution**

Check whether the test package contains the **OpenHarmonyTestRunner.abc** file. If the file does not exist, rebuild and pack the file and perform the test again.

#### Test case execution timeout

**Problem**

After the test case execution is complete, the console displays the error message "execute time XXms", indicating that the case execution times out.

**Possible Causes**

1. The test case is executed through an asynchronous interface, but the **done** function is not executed during the execution. As a result, the test case execution does not end until it times out.
E
ester.zhou 已提交
447 448 449

2. The time taken for API invocation is longer than the timeout interval set for test case execution.

E
ester.zhou 已提交
450
3. Test assertion fails, and a failure exception is thrown. As a result, the test case execution does not end until it times out.
E
esterzhou 已提交
451 452 453 454 455

**Solution**

1. Check the code logic of the test case to ensure that the **done** function is executed even if the assertion fails.

E
ester.zhou 已提交
456
2. Modify the case execution timeout settings under **Run/Debug Configurations** in DevEco Studio.
E
esterzhou 已提交
457

E
ester.zhou 已提交
458
3. Check the code logic and assertion result of the test case and make sure that the assertion is passed.
E
esterzhou 已提交
459 460 461 462 463 464
### FAQs About UI Test Cases

#### The failure log contains "Get windows failed/GetRootByWindow failed"

**Problem**

E
ester.zhou 已提交
465
The UI test case fails to be executed. The HiLog file contains the error message "Get windows failed/GetRootByWindow failed."
E
esterzhou 已提交
466 467 468

**Possible Causes**

E
ester.zhou 已提交
469
The ArkUI feature is disabled. As a result, the component tree information is not generated on the test page.
E
esterzhou 已提交
470 471 472 473 474 475 476 477 478

**Solution**

Run the following command, restart the device, and execute the test case again:

```shell
hdc shell param set persist.ace.testmode.enabled 1
```

E
ester.zhou 已提交
479
#### The failure log contains "uitest-api does not allow calling concurrently"
E
esterzhou 已提交
480 481 482

**Problem**

E
ester.zhou 已提交
483
The UI test case fails to be executed. The HiLog file contains the error message "uitest-api does not allow calling concurrently."
E
esterzhou 已提交
484 485 486

**Possible Causes**

E
ester.zhou 已提交
487
1. In the test case, the **await** operator is not added to the asynchronous API provided by the UI test framework.
E
esterzhou 已提交
488 489 490 491 492

2. The UI test case is executed in multiple processes. As a result, multiple UI test processes are started. The framework does not support multi-process invoking.

**Solution**

E
ester.zhou 已提交
493
1. Check the case implementation and add the **await** operator to the asynchronous API.
E
esterzhou 已提交
494 495
2. Do not execute UI test cases in multiple processes.

E
ester.zhou 已提交
496
#### The failure log contains "does not exist on current UI! Check if the UI has changed after you got the widget object"
E
esterzhou 已提交
497 498 499

**Problem**

E
ester.zhou 已提交
500
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."
E
esterzhou 已提交
501 502 503

**Possible Causes**

E
ester.zhou 已提交
504
After the target component is found in the code of the test case, the device UI changes, resulting in loss of the found component and inability to perform emulation.
E
esterzhou 已提交
505 506 507 508

**Solution**

Run the UI test case again.