From fe7ba7757141bf8f86534157477bd51fa6fbaff2 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Mon, 15 Nov 2021 07:21:52 +0000 Subject: [PATCH 1/5] update en/readme/test_subsystem.md. Signed-off-by: Annie_wang --- en/readme/test_subsystem.md | 62 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/en/readme/test_subsystem.md b/en/readme/test_subsystem.md index 5854b2d47cb..a56fca19fb5 100644 --- a/en/readme/test_subsystem.md +++ b/en/readme/test_subsystem.md @@ -4,7 +4,7 @@ OpenHarmony provides a comprehensive auto-test framework for designing test case This document describes how to use the OpenHarmony test framework. ## Setting Up the Environment The test framework depends on the Python running environment. Before using the test framework, set up the environment as follows: - - [Setting Up the Environment](../device-dev/subsystems/subsys-testguide-test.md#section175012297491) + - [Setting Up the Environment](../device-dev/subsystems/subsys-testguide-envbuild.md) - [Obtaining Source Code](../device-dev/get-code/sourcecode-acquire.md) @@ -39,21 +39,23 @@ subsystem # Subsystem │ │ ├── unittest # Unit test │ │ │ ├── common # Common test cases │ │ │ │ ├── BUILD.gn # Build file of test cases -│ │ │ │ ├── testA_test.cpp # Source code of unit test cases +│ │ │ │ └── testA_test.cpp # Source code of unit test cases │ │ │ ├── phone # Test cases for mobile phones │ │ │ ├── ivi # Test cases for head units │ │ │ └── liteos-a # Test cases for the IP cameras that use the LiteOS kernel -│ │ └── resource # Dependency resources -│ │ └── ohos_test.xml +│ │ ├── moduletest # Module test +│ │ ... +│ │ │ ├── moduleB # Module B │ ├── test -│ │ └── moduletest # Module test -│ │ ├── common -│ │ ├── phone -│ │ ├── ivi -│ │ └── liteos-a -│ │ ... -│ └── ohos_build # Build entry configuration +│ │ └── resource # Dependency resources +│ │ ├── moduleA # Module A +│ │ │ ├── ohos_test.xml # Resource configuration file +│ │ ... └── 1.txt # Resource +│ │ +│ ├── ohos_build # Build entry configuration +│ ... +│ ... ``` > **Note:** Test cases are classified into common test cases and device-specific test cases. You are advised to place common test cases in the **common** directory and device-specific test cases in the directories of the related devices. @@ -230,11 +232,15 @@ Example: - 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 comment must contain the test case name, description, type, and requirement number. The test case description must be in the @tc.xxx format. The test case type @tc.type can be any of the following: + - The comment must contain the test case name, description, type, and requirement number, which are in the @tc.*xxx*: *value* format. The test case description must be in the @tc.xxx format. The test case type @tc.type can be any of the following: - | Test Case Type|Function test|Performance test|Reliability test|Security test|Fuzz test| - | ------------|------------|------------|------------|------------|------------| - | Code|FUNC|PERF|RELI|SECU|FUZZ| + | Test Case Type|Code| + | ------------|------------| + |Function test |FUNC| + |Performance test |PERF| + |Reliability test |RELI| + |Security test |SECU| + |Fuzz test |FUZZ| **JavaScript Test Case Example** @@ -656,7 +662,7 @@ Perform the following steps: >- **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/$(component)** directory. + >- **src="out"** indicates that the test resources are in the **out/release/$(part)** directory. ## Executing Test Cases Before executing test cases, you need to modify the configuration based on the device used. @@ -730,7 +736,7 @@ When the build is complete, the test cases are automatically saved in the **out/ 3. Modify the **user_config.xml** file. ``` - . + false @@ -757,16 +763,16 @@ When the build is complete, the test cases are automatically saved in the **out/ ``` In the command: ``` - -t [TESTTYPE]: specifies the test case type, which can be UT, MST, ST, or PERF. This parameter is mandatory. - -tp [TESTTYPE]: specifies a part, which can be used independently. - -tm [TESTTYPE]: specifies a module. This parameter must be specified together with -tp. - -ts [TESTTYPE]: specifies a test suite, which can be used independently. - -tc [TESTTYPE]: specifies a test case. This parameter must be specified together with -ts. + -t [TESTTYPE]: specifies the test type, which can be UT, MST, ST, or PERF. 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 used 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 used together with -ts. You can run -h to display help information. ``` ### Executing Test Cases on Linux #### Mapping Remote Port -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 remove server or VM. Configure port mapping as follows: +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: 1. On the HDC server, run the following commands: ``` hdc_std kill @@ -797,11 +803,11 @@ To enable test cases to be executed on a remote Linux server or a Linux VM, map ``` In the command: ``` - -t [TESTTYPE]: specifies the test case type, which can be UT, MST, ST, or PERF. This parameter is mandatory. - -tp [TESTTYPE]: specifies a part, which can be used independently. - -tm [TESTTYPE]: specifies a module. This parameter must be specified together with -tp. - -ts [TESTTYPE]: specifies a test suite, which can be used independently. - -tc [TESTTYPE]: specifies a test case. This parameter must be specified together with -ts. + -t [TESTTYPE]: specifies the test type, which can be UT, MST, ST, or PERF. 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 used 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 used together with -ts. You can run -h to display help information. ``` -- Gitee From 2a52e8a13fac4ac0645556ffbe5ba8b2926d9bc5 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Tue, 16 Nov 2021 06:35:52 +0000 Subject: [PATCH 2/5] update en/readme/kernel-subsystem.md. Signed-off-by: Annie_wang --- en/readme/kernel-subsystem.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/en/readme/kernel-subsystem.md b/en/readme/kernel-subsystem.md index 65ef7049361..d9569d2f629 100644 --- a/en/readme/kernel-subsystem.md +++ b/en/readme/kernel-subsystem.md @@ -220,6 +220,11 @@ LiteOS: [prebuilts\_lite\_sysroot](https://gitee.com/openharmony/prebuilts_lite_sysroot/blob/master/README.md) Linux: +[kernel\_linux\_patches](https://gitee.com/openharmony/kernel_linux_patches/blob/master/README.md) + +[kernel\_linux\_config](https://gitee.com/openharmony/kernel_linux_config/blob/master/README.md) + +[kernel\_linux\_build](https://gitee.com/openharmony/kernel_linux_build/blob/master/README.md) [kernel\_linux\_4.19](https://gitee.com/openharmony/kernel_linux_4.19/blob/master/README) -- Gitee From 546f89ee8715e3e4289d2c597926d14ee5ffa347 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Tue, 16 Nov 2021 06:36:46 +0000 Subject: [PATCH 3/5] update en/readme/kernel-subsystem.md. Signed-off-by: Annie_wang --- en/readme/kernel-subsystem.md | 1 + 1 file changed, 1 insertion(+) diff --git a/en/readme/kernel-subsystem.md b/en/readme/kernel-subsystem.md index d9569d2f629..5706ca26148 100644 --- a/en/readme/kernel-subsystem.md +++ b/en/readme/kernel-subsystem.md @@ -220,6 +220,7 @@ LiteOS: [prebuilts\_lite\_sysroot](https://gitee.com/openharmony/prebuilts_lite_sysroot/blob/master/README.md) Linux: + [kernel\_linux\_patches](https://gitee.com/openharmony/kernel_linux_patches/blob/master/README.md) [kernel\_linux\_config](https://gitee.com/openharmony/kernel_linux_config/blob/master/README.md) -- Gitee From 19ee38603fc0d29e36829f2684b9ac264eb04e08 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Tue, 16 Nov 2021 08:16:05 +0000 Subject: [PATCH 4/5] update en/readme/test_subsystem.md. Signed-off-by: Annie_wang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 合入https://gitee.com/openharmony/docs/issues/I4I167 --- en/readme/test_subsystem.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/en/readme/test_subsystem.md b/en/readme/test_subsystem.md index a56fca19fb5..c548455b747 100644 --- a/en/readme/test_subsystem.md +++ b/en/readme/test_subsystem.md @@ -638,9 +638,9 @@ Configure the part build file to associate with specific test cases. Test case resources include external file resources, such as image files, video files, and third-party libraries, required for test case execution. Perform the following steps: -1. Under the **test** directory of a part or module, create the **resource** directory to store resource files. +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 **resource** directory, create the **ohos_test.xml** file in the following format: +2. In the module directory under **resource**, create the **ohos_test.xml** file in the following format: ``` @@ -655,7 +655,7 @@ Perform the following steps: 3. In the build file of the test cases, configure **resource\_config\_file** to point to the resource file **ohos\_test.xml**. ``` ohos_unittest("CalculatorSubTest") { - resource_config_file = "//system/subsystem/partA/calculator/test/resource/ohos_test.xml" + resource_config_file = "//system/subsystem/partA/test/resource/calculator/ohos_test.xml" } ``` >**Note:** -- Gitee From e11f1a5fdc2e4cbe9ffd28cbace5aba9729de1ad Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Tue, 16 Nov 2021 08:46:47 +0000 Subject: [PATCH 5/5] update en/readme/kernel-subsystem.md. Signed-off-by: Annie_wang --- en/readme/kernel-subsystem.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/en/readme/kernel-subsystem.md b/en/readme/kernel-subsystem.md index 5706ca26148..65ef7049361 100644 --- a/en/readme/kernel-subsystem.md +++ b/en/readme/kernel-subsystem.md @@ -221,12 +221,6 @@ LiteOS: Linux: -[kernel\_linux\_patches](https://gitee.com/openharmony/kernel_linux_patches/blob/master/README.md) - -[kernel\_linux\_config](https://gitee.com/openharmony/kernel_linux_config/blob/master/README.md) - -[kernel\_linux\_build](https://gitee.com/openharmony/kernel_linux_build/blob/master/README.md) - [kernel\_linux\_4.19](https://gitee.com/openharmony/kernel_linux_4.19/blob/master/README) [kernel\_linux\_5.10](https://gitee.com/openharmony/kernel_linux_5.10/blob/master/README) -- Gitee