@@ -42,9 +42,9 @@ Widget-related configuration includes **FormExtensionAbility** configuration and
| description | Description of the widget. The value can be a string or a resource index to descriptions in multiple languages. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| src | Full path of the UI code corresponding to the widget. For an ArkTS widget, the full path must contain the widget file name extension, for example, **./ets/widget/pages/WidgetCard.ets**. For a JS widget, the full path does not need to contain the widget file name extension, for example, **./js/widget/pages/WidgetCard**.| String| No|
| uiSyntax | Type of the widget.<br>- **arkts**: ArkTS widget<br>- **hml**: JS widget| String| Yes (initial value: **hml**)|
| isDefault | Whether the widget is a default one. Each UIAbility has only one default widget.<br>- **true**: The widget is the default one.<br>- **false**: The widget is not the default one.| Boolean| No|
| colorMode | Color mode of the widget.<br>- **auto**: auto-adaptive color mode<br>- **dark**: dark color mode<br>- **light**: light color mode| String| Yes (initial value: **auto**)|
| colorMode | Color mode of the widget.<br>- **auto**: following the system color mode<br>- **dark**: dark color mode<br>- **light**: light color mode| String| Yes (initial value: **auto**)|
| supportDimensions | Grid styles supported by the widget.<br>- **1 * 2**: indicates a grid with one row and two columns.<br>- **2 * 2**: indicates a grid with two rows and two columns.<br>- **2 * 4**: indicates a grid with two rows and four columns.<br>- **4 * 4**: indicates a grid with four rows and four columns.| String array| No|
| defaultDimension | Default grid style of the widget. The value must be available in the **supportDimensions** array of the widget.| String| No|
| updateEnabled | Whether the widget can be updated periodically.<br>- **true**: The widget can be updated at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** takes precedence over **scheduledUpdateTime**. If both are specified, the value specified by **updateDuration** is used.<br>- **false**: The widget cannot be updated periodically.| Boolean| No|
...
...
@@ -56,6 +56,13 @@ Widget-related configuration includes **FormExtensionAbility** configuration and
| dataProxyEnabled | Whether the widget supports the [update-through-proxy](./arkts-ui-widget-update-by-proxy.md) feature.<br>- **true**: The widget supports the update-through-proxy feature.<br>- **false**: The widget does not support the update-through-proxy feature.<br>If this tag is set to **true**, the settings for the scheduled update time will still take effect, but the settings for the update interval and next update time will not.| Boolean| Yes (initial value: **false**)|
| isDynamic | Whether the widget is a dynamic widget. This tag only applies to ArkTS widgets.<br>- **true**: The widget is a dynamic widget.<br>- **false**: The widget is a static widget. In this case, the widget is displayed as a static image after being added.| Boolean| Yes (initial value: **true**)|
**Table 2** Internal structure of the window object
| Field| Description| Data Type| Default Value Allowed|
| -------- | -------- | -------- | -------- |
| designWidth | Baseline width for page design. The size of an element is scaled by the actual device width.| Number| Yes (initial value: **720px**)|
| autoDesignWidth | Whether to automatically calculate the baseline width for page design. If it is set to **true**, the **designWidth** attribute will be ignored, and the baseline width will be calculated based on the device width and screen density.| Boolean| Yes (initial value: **false**)|
@@ -8,7 +8,7 @@ OpenHarmony provides you with a comprehensive development self-test framework **
This document describes how to use the development self-test framework of OpenHarmony.
### Introduction
### Overview
After adding or modifying code, OpenHarmony developers want to quickly verify whether the modified code functions properly, and the system already has a large number of automated test cases of existing functions, such as TDD cases and XTS cases. The development self-test framework aims to help you improve your self-test efficiency so that you can quickly execute the specified automated test cases and conducting development tests at the development phase.
...
...
@@ -18,7 +18,7 @@ After adding or modifying code, OpenHarmony developers want to quickly verify wh
When executing test cases using the framework, you must connect to the OpenHarmony device in advance.
## Environment Preparations
## Environment Setup
The development self-test framework depends on the Python environment. It is required that the Python version be 3.7.5 or later. Before using the framework, you can refer to the following document for configuration.
| Operating system | Ubuntu 18.04 or later | Code compilation environment. |
| Operating system | Ubuntu 20.04 or later | Code compilation environment. |
| Linux extension component| libreadline-dev | Plugin used to read commands. |
| python | 3.7.5 or later | Language used by the test framework. |
| Python plugins | pyserial 3.3 or later, paramiko 2.7.1 or later, setuptools 40.8.0 or later, and rsa4.0 or later| - **pserial**: supports Python serial port communication.<br>- **paramiko**: allows Python to use SSH. <br>- **setuptools**: allows Python packages to be created and distributed easily. <br>- **rsa**: implements RSA encryption in Python.|
| NFS Server | haneWIN NFS Server 1.2.50 or later or NFS v4 or later | Devices can be connected using serial ports. Mini- and small-system devices are used. |
| HDC | 1.1.0 | A tool that enables devices to be connected through the HarmonyOS Device Connector (HDC). |
| HDC | 1.2.0a | A tool that enables devices to be connected through the OpenHarmony Device Connector (HDC). |
1. Run the following command to install the Linux extended component readline:
1. Install Ubuntu.
As Ubuntu 20 has built-in Python 3.8.5, you do not need to install Python separately.
2. Run the following command to install the Linux extended component readline:
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
```
7. If the device supports HDC connection, install the HDC tool. For details about the installation process, see [HDC-OpenHarmony device connector](https://gitee.com/openharmony/developtools_hdc/blob/master/README.md).
7. If the device supports HDC connection, install the HDC tool. For details about the installation process, see [HDC-OpenHarmony Device Connector](https://gitee.com/openharmony/developtools_hdc/blob/master/README.md).
| Check whether Python is installed successfully. | Run the **python --version** command. | The Python version is 3.7.5 or later. |
| Check whether Python plugins are successfully installed. | Go to the **test/developertest** directory and run **start.bat** or **start.sh**.| The **>>>** prompt is displayed.|
| Check the NFS server status (for the devices that support only serial port output).| Log in to the development board through the serial port and run the **mount** command to mount the NFS. | The file directory can be mounted. |
| Check whether the HDC is successfully installed. | Run the **hdc_std -v** command. | The HDC version is 1.1.0 or later. |
| Check whether the HDC is successfully installed. | Run the **hdc -v** command. | The HDC version is 1.2.0a or later. |
## Test Case Preparation
The test framework supports multiple types of tests and provides different test case templates for them._
The test framework supports multiple types of tests and provides different test case templates for them.
**TDD Test (C++)**
Naming rules for source files
-Naming rules for source files
The source file name of test cases must be the same as that of the test suite. The file names must use lowercase letters and in the *Function*_*Sub-function*_**test** format. More specific sub-functions can be added as required.
Example:
```
calculator_sub_test.cpp
```
The source file name of test cases must be the same as that of the test suite. The file names must use lowercase letters and in the [Function]\_[Sub-function]\_**test** format. More specific sub-functions can be added as required.
Test case example
```c++
/*
* Copyright (c) 2021 XXXX Device Co., Ltd.
- The following uses **calculator_sub_test.cpp** as an example to describe how to compile a single-thread test case:
```
/*
* Copyright (c) 2023 XXXX Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -151,61 +154,59 @@ Test case example
* limitations under the License.
*/
#include "calculator.h"
#include <gtest/gtest.h>
#include "calculator.h"
#include <gtest/gtest.h>
usingnamespacetesting::ext;
using namespace testing::ext;
classCalculatorSubTest:publictesting::Test{
public:
class CalculatorSubTest : public testing::Test {
public:
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp();
void TearDown();
};
};
voidCalculatorSubTest::SetUpTestCase(void)
{
void CalculatorSubTest::SetUpTestCase(void)
{
// Set a setup function, which will be called before all test cases.
}
}
voidCalculatorSubTest::TearDownTestCase(void)
{
void CalculatorSubTest::TearDownTestCase(void)
{
// Set a teardown function, which will be called after all test cases.
}
}
voidCalculatorSubTest::SetUp(void)
{
void CalculatorSubTest::SetUp(void)
{
// Set a setup function, which will be called before all test cases.
}
}
voidCalculatorSubTest::TearDown(void)
{
void CalculatorSubTest::TearDown(void)
{
// Set a teardown function, which will be called after all test cases.
| HWTEST(A,B,C) | Use this template if the test case execution does not depend on setup or teardown. |
| HWTEST_F(A,B,C) | Use this template if the test case execution (excluding parameters) depends on setup or teardown.|
| HWTEST_P(A,B,C) | Use this template if the test case execution (including parameters) depends on setup or teardown. |
#include "base_object.h"
#include <gtest/gtest.h>
#include <gtest/hwext/gtest-multithread.h>
#include <unistd.h>
In the template names:
using namespace testing::ext;
using namespace testing::mt;
-**A** indicates the test suite name.
namespace OHOS {
namespace AAFwk {
class AAFwkBaseObjectTest : public testing::Test {......}
-**B** indicates the test case name, which is in the *Function*_*No.* format. The *No.* is a three-digit number starting from **001**.
// Step 1 Set the function to be tested to return the factorial result.
int factorial(int n)
{
int result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
}
printf("Factorial Function Result : %d! = %d\n", n, result);
return result;
}
-*C* indicates the test case level. There are five test case levels: guard-control level 0 and non-guard-control level 1 to level 4. Of levels 1 to 4, a smaller value indicates a more important function verified by the test case.
// Step 2 Use an assertion to compare the obtained result with the expected result.
void factorial_test()
{
int ret = factorial(3); // Call the function to obtain the result.
- The expected result of each test case must have an assertion.
} // namespace AAFwk
} // namespace OHOS
- The test case level must be specified.
```
The procedure is as follows:
1. Add comment information to the test case file header.
> **NOTE**<br>The standard is the same as that of the single-thread test case.
- It is recommended that the test be implemented step by step according to the template.
2. Add the test framework header file and namespace.
```
#include <gtest/gtest.h>
#include <gtest/hwext/gtest-multithread.h>
#include <unistd.h>
using namespace testing::ext;
using namespace testing::mt;
```
3. Add the header file of the test class.
```
#include "base_object.h"
```
4. Define the test suite (test class).
```
class AAFwkBaseObjectTest : public testing::Test {......}
- The comment must contain the test case name, description, type, and requirement number, which are in the @tc.*xxx*: *value* format. The test case type @**tc.type** can be any of the following:
```
> **NOTE**<br>The standard is the same as that of the single-thread test case.
5. Add implementation of the test cases, including test case comments and logic.
| Test Case Type| Code|
| ------------ | -------- |
| Function test | FUNC |
| Performance test | PERF |
| Reliability test | RELI |
| Security test | SECU |
| Fuzzing test | FUZZ |
```
// Step 1 Set the function to be tested to return the factorial result.
int factorial(int n)
{
int result = 1;
for (int i = 1; i <= n; i++) {
result *= i;
}
printf("Factorial Function Result : %d! = %d\n", n, result);
return result;
}
// Step 2 Use an assertion to compare the obtained result with the expected result.
void factorial_test()
{
int ret = factorial(3); // Call the function to obtain the result.
// Add the multi-thread API MTEST_ADD_TASK(THREAD_ID,ThreadTestFunc). Multiple threads are registered but are not executed in this test case. Instead, they are executed later in a unified manner. This API is applicable to the multi-thread test in the scenario where multiple test cases are combined.
// THREAD_ID is used to distinguish threads and starts from 0. You can also use a random thread ID by passing in RANDOM_THREAD_ID. In this scenario, each thread ID is unique.
// Add the multi-thread API MTEST_POST_RUN() to execute the previously registered threads in a unified manner.
```
> **NOTE**<br>The comments for multi-thread test cases are the same as those of single-thread test cases.
**TDD Test (JS)**
- About C++ test case templates:
The following test case templates are provided for your reference.
| Type| Description|
| ------------| ------------|
| HWTEST(A,B,C)| Use this template if the test case execution does not depend on setup or teardown.|
| HWTEST_F(A,B,C)| Use this template if the test case execution (excluding parameters) depends on setup and teardown.|
| HWMTEST_F(A,B,C,D)| Use this template if the multi-thread test case execution depends on setup and teardown.|
| HWTEST_P(A,B,C)| Use this template if the test case execution (including parameters) depends on setup and teardown.|
In the template names:
- **A** indicates the test suite name.
- **B** indicates the test case name, which is in the *Function*_*No.* format. The *No.* is a three-digit number starting from **001**.
- **C** indicates the test case level. There are five test case levels: guard-control level 0 and non-guard-control level 1 to level 4. Of levels 1 to 4, a smaller value indicates a more important function verified by the test case.
- **D** indicates the number of threads for executing the multi-thread test case.
**Note**:
- The expected result of each test case must have an assertion.
- The test case level must be specified.
- It is recommended that the test be implemented step by step according to the template.
- The test case description is in the standard @tc.*xxx* *value* format. The comment must contain the test case name, description, type, and requirement number. The test case type @tc.type can be any of the following:
| Test Case Type | Code |
| ------------ | -------- |
| Function test | FUNC |
| Performance Test | PERF |
| Reliability test | RELI |
| Security Test | SECU |
| Fuzz test | FUZZ |
**TDD Test (JavaScript)**
- Naming rules for source files
The source file name of a test case must be in the *Function**Sub-function***Test** format, and each part must use the upper camel case style. More specific sub-functions can be added as required.
Example:
```
AppInfoTest.js
```
The source file name of a test case must be in the [Function][Sub-function]**Test** format, and each part must use the upper camel case style. More specific sub-functions can be added as required.
Example:
```
AppInfoTest.js
```
- Test case example
```js
/*
* Copyright (C) 2021 XXXX Device Co., Ltd.
```js
/*
* Copyright (C) 2023 XXXX Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
...
...
@@ -355,11 +487,11 @@ AppInfoTest.js
* See the License for the specific language governing permissions and
> The output path is the *Part name*/*Module name*.
4. Set the output build file for the test cases.
4. Set the output build file for the test cases.
```
ohos_js_unittest("GetAppInfoJsTest") {
}
```
> **NOTE**
> - Use the **ohos_js_unittest** template to define the JavaScript test suite. Pay attention to the difference between JavaScript and C++.
> - The file generated for the JavaScript test suite must be in .hap format and named after the test suite name defined here. The test suite name must end with **JsTest**.
> - Use the **ohos_js_unittest** template to define the JavaScript test suite. Pay attention to the difference between JavaScript and C++.
> - The file generated for the JavaScript test suite must be in .hap format and named after the test suite name defined here. The test suite name must end with **JsTest**.
5. Configure the **config.json** file and signature file, which are mandatory.
5. Configure the **config.json** file and signature file, which are mandatory.
**config.json** is the configuration file required for HAP build. You need to set **target** based on the tested SDK version. Default values can be retained for other items. The following is an example:
}
```
**config.json** is the configuration file required for HAP build. You need to set **target** based on the tested SDK version. Default values can be retained for other items. The following is an example:
> **test_list** contains the test cases of the corresponding module.
## Configuring Test Resources
Test resources include external file resources, such as image files, video files, and third-party libraries, required for test case execution.
The test resources mainly include external file resources such as image files, video files, and third-party libraries required during test case execution. Currently, only static resources can be configured.
Perform the following steps:
1. Create a **resource** directory under the **test** directory of the part, create a corresponding module directory under the **resource** directory, and store the resource files required in this module directory.
1. Create the **resource** directory in the **test** directory of the part, and create a directory for the module in the **resource** directory to store resource files of the module.
2. In the module directory under **resource**, create the **ohos_test.xml** file in the following format:
>- **target_name** indicates the test suite name defined in the **BUILD.gn** file in the **test** directory. **preparer** indicates the action to perform before the test suite is executed.
>- **src="res"** indicates that the test resources are in the **resource** directory under the **test** directory. **src="out"** indicates that the test resources are in the **out/release/$(*part*)** directory.
>- **target_name** indicates the test suite name defined in the **BUILD.gn** file in the **test** directory. **preparer** indicates the action to perform before the test suite is executed.
>- **src="res"** indicates that the test resources are in the **resource** directory under the **test** directory. **src="out"** indicates that the test resources are in the **out/release/$(*part*)** directory.
## Test Case Execution
### Configuration File
### Configuration File user_config.xml
Before executing test cases, you need to modify the configuration based on the device used.
Before executing test cases, you need to modify the configuration in **developer_test\config\user_config.xml**based on the device used.
#### Modifying user_config.xml
```xml
<user_config>
<build>
...
...
@@ -849,59 +1103,33 @@ Before executing test cases, you need to modify the configuration based on the d
>If HDC is connected to the device before the test cases are executed, you only need to configure the device IP address and port number, and retain the default settings for other parameters.
>If HDC is connected to the device before the test cases are executed, you only need to configure the device IP address and port number, and retain the default settings for other parameters.
### Command Description
1. Start the test framework.
```
start.bat
```
2. Select the product.
After the test framework starts, you are asked to select a product. Select the development board to test.
If you need to manually add a product, add it within the **\<productform\>** tag to **config/framework_config.xml**.
3. Execute test cases.
Run the following command to execute test cases:
```
run -t UT -ts CalculatorSubTest -tc interger_sub_00l
```
In the command:
```
-**t [TESTTYPE]**: specifies the test type, which can be **UT**, **MST**, **ST**, **PERF**, **FUZZ**, or **BENCHMARK**. This parameter is mandatory.
-**tp [TESTPART]**: specifies the part to test. This parameter can be used independently.
-**tm [TESTMODULE]**: specifies the module to test. This parameter must be specified together with **-tp**.
-**ts [TESTSUITE]**: specifies a test suite. This parameter can be used independently.
-**tc [TESTCASE]**: specifies a test case. This parameter must be specified together with **-ts**.
-**h**: displays help information.
```
#### Executing Test Cases on Windows
### Executing Test Cases on Windows
#### **Test Case Building**
Test cases cannot be built on Windows. You need to run the following command to build test cases on Linux:
>- **product-name**: specifies the name of the product to be compiled.
>- **build-target**: specifies the test case to build. **make_test** indicates all test cases. You can specify the test cases based on requirements.
After the build is complete, the test cases are automatically saved in **out/ohos-arm-release/packages/phone/tests**.
When the build is complete, the test cases are automatically saved in **out/ohos-arm-release/packages/phone/tests**.
##### Setting Up the Execution Environment
#### Setting Up the Execution Environment
1. On Windows, create the **Test** directory in the test framework and then create the **testcase** directory in the **Test** directory.
2. Copy **developertest** and **xdevice** from the Linux environment to the **Test** directory on Windows, and copy the test cases to the **testcase** directory.
>**\<testcase>** indicates whether to build test cases. **\<dir>** indicates the path for searching for test cases.
> **\<testcase>** indicates whether to build test cases. **\<dir>** indicates the path for searching for test cases.
#### Executing Test Cases on Linux
#### Executing Test Cases
1. Start the test framework.
```
start.bat
```
2. Select the product.
After the test framework starts, you are asked to select a product. Select the development board to test.
If you need to manually add a product, add it within the **\<productform\>** tag to **config/framework_config.xml**.
3. Execute the test cases.
Run the following commands to execute test cases:
```
run -t UT
run -t UT -tp PartName
run -t UT -tp PartName -tm TestModuleName
run -t UT -tp ability_base -ts base_object_test
run -t UT -tp PartName -tm TestModuleName -ts CalculatorSubTest
run -t UT -ts base_object_test
run -t UT -ts base_object_test -tc AAFwkBaseObjectTest.BaseObject_test_001
run -t UT -ts CalculatorSubTest -tc CalculatorSubTest.interger_sub_00l
run -t UT -cov coverage
run -t UT -ra random
run -t UT -ts base_object_test --repeat 5
run -hl
run -rh 3
run --retry
```
If you directly connect to a Linux host, you can directly run commands to execute test cases.
##### Mapping the Remote Port
In the command:
```
-**t [TESTTYPE]**: specifies the test type, which can be **UT**, **MST**, **ST**, **PERF**, **FUZZ**, **BENCHMARK**, **ACTS**, **HATS**, and more. This parameter is mandatory.
-**tp [TESTPART]**: specifies the part to test. This parameter can be used independently.
-**tm [TESTMODULE]**: specifies the module to test. This parameter must be specified together with **-tp**.
-**ts [TESTSUITE]**: specifies the test suite. This parameter can be used independently.
-**tc [TESTCASE]**: specifies the test case. This parameter must be specified together with **-ts** to indicate the test suite.
-**cov [COVERAGE]**: specifies the coverage.
-**h**: displays help information.
-**ra [random]**: specifies the out-of-order execution for C++ cases.
--**repeat**: specifies the number of case execution times.
-**hl [HISTORYLIST]**: enables the display of the latest 10 test cases. If there are more than 10 test cases, only the latest 10 test cases are displayed.
-**rh [RUNHISTORY]**: specifies the sequence number of the historical record to execute.
--**retry**: checks the last execution result and re-runs the failed test cases, if any.
```
### Executing Test Cases on Linux
#### Configuring Remote Port Mapping and Modifying Configuration File
To enable test cases to be executed on a remote Linux server or a Linux VM, map the port to enable communication between the device and the remote server or VM. Configure port mapping as follows:
<!--If a test case needs to be compiled, set this attribute is true. Otherwise, set it to false. -->
<testcase>true</testcase>
</build>
<environment>
<!-- Configure the IP address, port number, and SN of the remote server to support connection to the device through HDC. -->
<devicetype="usb-hdc">
<ip></ip>
<port></port>
<sn></sn>
</device>
<environment>
```
#### Executing Test Cases
1. Start the test framework.
```
./start.sh
```
2. Select the product.
After the test framework starts, you are asked to select a product. Select the development board to test.
If the displayed product list does not contain the target one, you can add it in the **\<productform\>** tag in **config/framework_config.xml**.
```
<framework_config>
<productform>
<option name="ipcamera_hispark_aries" />
<option name="ipcamera_hispark_taurus" />
<option name="wifiiot_hispark_pegasus" />
<option name="" />
</productform>
</framework_config>
```
3. Execute the test cases.
1. TDD commands
The test framework locates the test cases based on the command, and automatically builds and executes the test cases.
```
run -t UT
run -t UT -tp PartName
run -t UT -tp PartName -tm TestModuleName
run -t UT -tp ability_base -ts base_object_test
run -t UT -tp PartName -tm TestModuleName -ts CalculatorSubTest
run -t UT -ts base_object_test
run -t UT -ts base_object_test -tc AAFwkBaseObjectTest.BaseObject_test_001
run -t UT -ts CalculatorSubTest -tc CalculatorSubTest.interger_sub_00l
run -t -cov coverage
run -t UT -ra random
run -t UT -tp PartName -pd partdeps
run -t UT -ts base_object_test --repeat 5
run -hl
run -rh 3
run --retry
```
In the command:
```
-**t [TESTTYPE]**: specifies the test type, which can be **UT**, **MST**, **ST**, **PERF**, **FUZZ**, and **BENCHMARK**. This parameter is mandatory.
-**tp [TESTPART]**: specifies the part to test. This parameter can be used independently.
-**tm [TESTMODULE]**: specifies the module to test. This parameter must be specified together with **-tp**.
-**ts [TESTSUITE]**: specifies the test suite. This parameter can be used independently.
-**tc [TESTCASE]**: specifies the test case. This parameter must be specified together with **-ts** to indicate the test suite.
-**cov [COVERAGE]**: specifies the coverage.
-**h**: displays help information.
-**ra [random]**: specifies the out-of-order execution for C++ cases.
-**pd [partdeps]**: specifies execution parameter of the level-2 part dependencies.
--**repeat**: specifies the number of case execution times.
-**hl [HISTORYLIST]**: enables the display of the latest 10 test cases. If there are more than 10 test cases, only the latest 10 test cases are displayed.
-**rh [RUNHISTORY]**: specifies the sequence number of the historical record to execute.
--**retry**: checks the last execution result and re-runs the failed test cases, if any.
```
In Linux, you can run the following commands to view the supported product forms, test types, subsystems, and parts.
```
To view the help information, run **help**.
To view the **show** command, run **help show**.
To view the supported product forms, run **show productlist**.
To view the supported test types, run **show typelist**.
To view the supported test subsystems, run **show subsystemlist** .
To view the supported test parts, run **show partlist**.
```
2. ACTS/HATS commands
After selecting the product, you can refer to the following to execute the ACTS or HATS test cases.
```
run -t ACTS
run -t HATS
run -t ACTS -ss arkui
run -t ACTS -ss arkui, modulemanager
run -t ACTS -ss arkui -ts ActsAceEtsTest
run -t HATS -ss telephony -ts HatsHdfV1RilServiceTest
run -t ACTS -ss arkui -tp ActsPartName
run -t ACTS -ss arkui -ts ActsAceEtsTest,ActsAceEtsResultTest
run -t HATS -ss powermgr -ts HatsPowermgrBatteryTest,HatsPowermgrThermalTest
run -t ACTS -ss arkui -ts ActsAceEtsTest -ta class:alphabetIndexerTest#alphabetIndexerTest001
The parameters in the ACTS and HATS commands are the same, but are different from those in TDD commands.
```
-**t [TESTTYPE]**: specifies the test case type, which can be **ACTS** or **HATS**. This parameter is mandatory.
-**ss [SUBSYSTEM]**: specifies the subsystem to test. This parameter can be used independently. To specify multiple subsystems, separate them with commas (,).
-**tp [TESTPART]**: specifies the part to test. This parameter can be used independently.
-**ts [TESTSUITE]**: specifies the test suite. This parameter can be used independently. To specify multiple test suites, separate them with commas (,).
-**ta [TESTARGS]**: specifies the test method. This parameter must be used together with **-ts**.
--**repeat**: specifies the number of case execution times.
-**hl [HISTORYLIST]**: enables the display of the latest 10 test cases. If there are more than 10 test cases, only the latest 10 test cases are displayed.
-**rh [RUNHISTORY]**: specifies the sequence number of the historical record to execute.
--**retry**: checks the last execution result and re-runs the failed test cases, if any.
```
## Viewing the Test Result
### Test Report Logs
After the test cases are executed, the test result will be automatically generated. You can view the detailed test result in the related directory.
After the test is executed, the console automatically generates the test result.
### Test Result
You can obtain the test result in the following directory:
>The folder for test reports is automatically generated.
> The test report folder is automatically generated.
The folder contains the following files:
| Type | Description |
...
...
@@ -964,12 +1359,54 @@ The folder contains the following files:
| summary_report.html | Test report summary. |
| details_report.html | Detailed test report. |
### Test Framework Logs
```
reports/platform_log_xxxx_xx_xx_xx_xx_xx.log
```
### Latest Test Report
```
reports/latest
```
## Executing Coverage Cases
When GCDA data is available, you can execute the test cases as follows for subsystems to generate a coverage report:
1. (Optional) To block redundant branch data generated by non-core code, run the following command in the **/test/testfwk/developer_test/localCoverage/restore_comment** directory before source code compilation:
python3 build_before_generate.py
Run the following command to select the parts to be blocked during compilation:
run -tp partname
run -tp partname1 partname2
2. Before compiling the version, modify the compilation options. Add **-- coverage** to the **cflags**, **cflags_cc**, and **ldflags** options in the **build.gn** file of the involved subsystem.
ldflags = [ "--coverage" ]
C: cflags = [ "--coverage" ]
C++: cflags_cc = [ "--coverage" ]
**Recommended**: You can also refer to the mode for the window subsystem. For details, see the files in this [pull request](https://gitee.com/openharmony/window_window_manager/pulls/1274/files).
3. To execute coverage test cases, perform the following to install the dependencies:
1. Run the **sudo apt install lcov** command to install lcov.
2. Run the **apt install dos2unix** command to install dos2unix.
3. Run the **pip install lxml** command to install lxml.
4. Run the **pip install selectolax** command to install selectolax.
5. Run the **pip install CppHeaderParser** command to install CppHeaderParser.
4. To map a remote device, set its IP address in the **usr_config.xml** file. For details about device mapping, see [Configuring Remote Port Mapping and Modifying Configuration File](#configuring-remote-port-mapping-and-modifying-configuration-file).
<!-- Set the IP address of the remote host to map (IP address of the PC to which the device is mounted).-->
<device type="usb-hdc">
<ip></ip>
<port></port>
<sn></sn>
</device>
5. Run the **./start.sh** command. Below are examples:
run -t UT -tp *Part name* -cov coverage
run -t UT -ss *Subsystem name* -cov coverage
run -t UT -ss *Subsystem name* -tp **Part name** -cov coverage
run -t UT MST ST -tp *Part name* -cov coverage
Note: The **-cov coverage** parameter must be added to the preceding commands.
6. Obtain the coverage report from the following paths:
When building a child component, do not assign values to the variables by **@LocalStorageLink** and **@LocalStorageProp** in the child component.
To change these variables from the parent component, use the API provided by the **LocalStorage** (such as the **set** API) to assign values to them.
## cl.arkui.3 Change of the bottom Definition in Toast Options in the PromptAction Module
Changed the definition of the **bottom** attribute in toast options from distance between the top of the toast and the bottom of the screen to distance between the bottom of the toast and the bottom of the screen.
**Example**
```ts
importpromptActionfrom'@ohos.promptAction';
@Entry
@Component
structIndex{
build(){
Row(){
Button()
.onClick(()=>{
try{
promptAction.showToast({
message:'Message Info',
duration:2000
});
}catch(error){
console.error(`showToast args error code is ${error.code}, message is ${error.message}`);
};
})
}
}
}
```
**Change Impacts**
In the **PromptAction** module, the same value for the **bottom** attribute may result in different toast appearances, depending on whether the API version used by the compiler is earlier than 10 or not.
**Key API/Component Changes**
N/A
**Adaptation Guide**
When setting the **bottom** attribute, account for the definition change.
## cl.arkui.4 Content Layout Change of AlertDialog
The content layout of the alert dialog box varies according to the following conditions: 1. whether there is a title. 2. whether the text is on a single line.
Currently, only the single-line text without a title is centered. In other cases, the text is left-aligned.
**Example**
```ts
// xxx.ets
@Entry
@Component
structAlertDialogExample{
build(){
Column({space:5}){
Button('one button dialog')
.onClick(()=>{
AlertDialog.show(
{
title:'title',
message:'text'.repeat(20),
autoCancel:true,
alignment:DialogAlignment.Bottom,
offset:{dx:0,dy:-20},
gridCount:3,
confirm:{
value:'button',
action:()=>{
console.info('Button-clicking callback')
}
},
cancel:()=>{
console.info('Closed callbacks')
}
}
)
})
.backgroundColor(0x317aff)
}.width('100%').margin({top:5})
}
}
```
**Change Impacts**
The layout for the text specified by the **message** attribute of the alert dialog box is subject to the title and number of lines of the text.
**Key API/Component Changes**
N/A
**Adaptation Guide**
No proactive adaptation is required. You can also use **customDialog** for related implementation.
## cl.arkui.5 Avoidance Behavior Optimization of Popup
Before the change, the popup preferentially uses the lower area for avoidance. As a result, it cannot be displayed in the upper area even if the space is sufficient.
After the change: The popup preferentially uses the upper area for avoidance when it is configured to show above the target component; it preferentially uses the upper or lower area for avoidance when it is configured to show below the target component.
**Change Impacts**
The optimized popup avoidance behavior occurs when the **bindpopup** attribute is used.
**Key API/Component Changes**
N/A
**Adaptation Guide**
If the popup position is not as expected, you can adjust the **placement** settings.