Signed-off-by caojiale1 caojiale1@huawei.com

Signed-off-by: caojiale1 <caojiale1@huawei.com>
This commit is contained in:
caojiale1 2023-08-18 16:41:14 +08:00
parent cc58d33d16
commit 0bffa03409
20 changed files with 61 additions and 61 deletions

View File

@ -15,7 +15,7 @@ This module allows you to develop new test cases for new features, or modify exi
## Directory Structure<a name="section102031353175317"></a>
```
developertest/
developer_test/
├── aw # Static libraries of the test framework
│ ├── cxx # C++ libraries
│ └── python # Python libraries
@ -157,7 +157,7 @@ The Python environment is required.
```
- Configure the developers test module in the configuration file **developertest/config/user\_config.xml**.
- Configure the developers test module in the configuration file **developer_test/config/user\_config.xml**.
1. Modify basic configuration parameters of the test framework.
\[build\] \# Configure build parameters of the test case.
@ -206,7 +206,7 @@ The Python environment is required.
```
- \(Optional\) Modify the configuration file **config/user\_config.xml** of the **developertest** module. If a test case has been compiled, specify the compilation output directory of the test case. In this case, the test platform will not recompile the test case.
- \(Optional\) Modify the configuration file **config/user\_config.xml** of the **developer_test** module. If a test case has been compiled, specify the compilation output directory of the test case. In this case, the test platform will not recompile the test case.
1. Specify the output directory of the test case, that is, the compilation output directory between the **<test\_cases\>** tags.
```
@ -232,7 +232,7 @@ The Python environment is required.
- An empty directory is created on the development host for mounting test cases through the NFS, and the NFS service is started properly.
- Run test suites.
- Start the test framework and go to the **test/developertest** directory.
- Start the test framework and go to the **test/developer_test** directory.
1. Run the following command to start the test framework in Windows.
```
@ -248,7 +248,7 @@ The Python environment is required.
- Select a device form.
Configure device forms based on the actual development board, for example, **developertest/config/framework\_config.xml**.
Configure device forms based on the actual development board, for example, **developer_test/config/framework\_config.xml**.
- Run test commands.
1. To query the subsystems, modules, product forms, and test types supported by test cases, run the **show** commands.
@ -358,6 +358,6 @@ The Python environment is required.
[testing subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/test.md)
**test\_developertest**
**test\_developer_test**
[test\_xdevice](https://gitee.com/openharmony/testfwk_xdevice/blob/master/README.md)
[test\_xdevice](https://gitee.com/openharmony/testfwk_xdevice/blob/master/README_zh.md)

View File

@ -1,5 +1,5 @@
# 开发自测试执行框架
OpenHarmony为开发者提供了一套全面的开发自测试框架OHA-developertest开发者可根据测试需求开发相关测试用例开发阶段提前发现缺陷大幅提高代码质量。
OpenHarmony为开发者提供了一套全面的开发自测试框架OHA-developer_test开发者可根据测试需求开发相关测试用例开发阶段提前发现缺陷大幅提高代码质量。
本文从基础环境构建用例开发编译以及执行等方面介绍OpenHarmony开发自测试执行框架如何运行和使用。
## 基础环境构建
@ -13,7 +13,7 @@ OpenHarmony为开发者提供了一套全面的开发自测试框架OHA-develope
以下是开发自测试框架的目录层级架构,在使用开发自测试框架过程中可在相应目录查找对应组件。
```
test # 测试子系统
├── developertest # 开发者自测试框架
├── developer_test # 开发者自测试框架
│ ├── aw # 测试框架的静态库
│ ├── config # 测试框架配置
│ │ │ ...
@ -549,7 +549,7 @@ subsystem # 子系统
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
config("module_private_config") {
visibility = [ ":*" ]
@ -589,7 +589,7 @@ subsystem # 子系统
```
3. 指定文件输出路径
```
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
```
> **说明:** 此处输出路径为部件/模块名。
@ -653,13 +653,13 @@ subsystem # 子系统
import("//build/test.gni")
module_output_path = "developertest/app_info"
module_output_path = "developer_test/app_info"
ohos_js_unittest("GetAppInfoJsTest") {
module_out_path = module_output_path
hap_profile = "./config.json"
certificate_profile = "//test/developertest/signature/openharmony_sx.p7b"
certificate_profile = "//test/developer_test/signature/openharmony_sx.p7b"
}
group("unittest") {
@ -683,7 +683,7 @@ subsystem # 子系统
3. 指定文件输出路径
```
module_output_path = "developertest/app_info"
module_output_path = "developer_test/app_info"
```
> **说明:** 此处输出路径为部件/模块名。
@ -704,7 +704,7 @@ subsystem # 子系统
module_out_path = module_output_path
hap_profile = "./config.json"
certificate_profile = "//test/developertest/signature/openharmony_sx.p7b"
certificate_profile = "//test/developer_test/signature/openharmony_sx.p7b"
}
```
config.json为hap编译所需配置文件需要开发者根据被测sdk版本配置“target”项其余项可默认具体如下所示
@ -786,7 +786,7 @@ subsystem # 子系统
import("//build/test.gni")
want_output_path = "developertest/stage_test"
want_output_path = "developer_test/stage_test"
ohos_js_stage_unittest("ActsBundleMgrStageEtsTest") {
hap_profile = "entry/src/main/module.json"
@ -797,7 +797,7 @@ subsystem # 子系统
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsBundleMgrStageEtsTest"
subsystem_name = "developertest"
subsystem_name = "developer_test"
part_name = "stage_test" // 部件名称
module_out_path = want_output_path // 必须定义输出路径
}
@ -951,7 +951,7 @@ subsystem # 子系统
##### 搭建执行环境
1. 在Windows环境创建测试框架目录Test并在此目录下创建testcase目录
2. 从Linux环境拷贝测试框架developertest和xdevice到创建的Test目录下拷贝编译好的测试用例到testcase目录下
2. 从Linux环境拷贝测试框架developer_test和xdevice到创建的Test目录下拷贝编译好的测试用例到testcase目录下
>**说明:** 将测试框架及测试用例从Linux环境移植到Windows环境以便后续执行。
@ -1144,7 +1144,7 @@ subsystem # 子系统
#### 测试结果
测试结果输出根路径如下:
```
test/developertest/reports/xxxx_xx_xx_xx_xx_xx
test/developer_test/reports/xxxx_xx_xx_xx_xx_xx
```
>**说明:** 测试报告文件目录将自动生成。

View File

@ -27,6 +27,6 @@ ohos_static_library("performance_test_static") {
public_deps = [ "//third_party/libxml2:libxml2" ]
public_configs = [ ":performance_test_config" ]
subsystem_name = "testfwk"
part_name = "developertest"
part_name = "developer_test"
external_deps = [ "c_utils:utils" ]
}

View File

@ -1,7 +1,7 @@
{
"name": "@openharmony/developertest",
"name": "@openharmony/developer_test",
"version": "3.1.0",
"description": "developertest",
"description": "developer_test",
"license": "Apache License 2.0",
"publishAs": "code-segment",
"segment": {
@ -11,7 +11,7 @@
"repository": "",
"dirs": {},
"component": {
"name": "developertest",
"name": "developer_test",
"subsystem": "testfwk",
"features" :[],
"adapted_system_type": [ "standard" ],

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/app_info"
module_output_path = "developer_test/app_info"
ohos_js_unittest("GetAppInfoJsTest") {
module_out_path = module_output_path

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
ohos_benchmarktest("BenchmarkDemoTest") {
module_out_path = module_output_path

View File

@ -14,7 +14,7 @@
import("//build/config/features.gni")
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
##############################fuzztest##########################################
ohos_fuzztest("CalculatorFuzzTest") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
###############################################################################
config("module_private_config") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
###############################################################################
config("module_private_config") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/detector"
module_output_path = "developer_test/detector"
###############################################################################
config("module_private_config") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/distributedb"
module_output_path = "developer_test/distributedb"
###############################################################################
config("module_private_config") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
module_output_path = "developertest/sleep"
module_output_path = "developer_test/sleep"
###############################################################################
config("module_private_config") {

View File

@ -13,7 +13,7 @@
import("//build/test.gni")
want_output_path = "developertest/stage_test"
want_output_path = "developer_test/stage_test"
ohos_js_stage_unittest("ActsBundleMgrStageEtsTest") {
hap_profile = "entry/src/main/module.json"

View File

@ -263,7 +263,7 @@ BENCHMARK_MAIN();
import("//build/test.gni")
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
ohos_benchmarktest("BenchmarkDemoTest") {
module_out_path = module_output_path
@ -309,7 +309,7 @@ group("benchmarktest") {
3. 指定文件输出路径
```
module_output_path = "developertest/calculator"
module_output_path = "developer_test/calculator"
```
> **说明:** 此处输出路径为部件/模块名。

View File

@ -36,7 +36,7 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or
### 配置启动测试框架<a name="section005187487501"></a>
参考[ 开发者测试组件](https://gitee.com/openharmony/test_developertest/blob/master/README_zh.md)中的描述完成测试框架安装、设备连接配置并在linux环境下通过
参考[ 开发者测试组件](https://gitee.com/openharmony/testfwk_developer_test/blob/master/README_zh.md)中的描述完成测试框架安装、设备连接配置并在linux环境下通过
```
./start.sh
@ -77,10 +77,10 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or
3. gen命令示例-t、-fn和-dp均为必选项
```
gen -t FUZZ -fn calculator_fuzzer -dp test/developertest/example/calculator/test/fuzztest/common
gen -t FUZZ -fn calculator_fuzzer -dp test/developer_test/example/calculator/test/fuzztest/common
```
执行完毕后会在test/developertest/example/calculator/test/fuzztest/common目录下生成一个Fuzz用例demo。
执行完毕后会在test/developer_test/example/calculator/test/fuzztest/common目录下生成一个Fuzz用例demo。
@ -149,7 +149,7 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or
```
ohos_fuzztest("CalculatorFuzzTest") { #定义测试套名称CalculatorFuzzTest
module_out_path = module_output_path
fuzz_config_file = "//test/developertest/examples/calculator/test/fuzztest/common/calculator_fuzzer"
fuzz_config_file = "//test/developer_test/examples/calculator/test/fuzztest/common/calculator_fuzzer"
include_dirs = []
cflags = [
"-g",
@ -202,11 +202,11 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or
```
"tests": [
"//test/developertest/examples/calculator/test:unittest",
"//test/developertest/examples/calculator/test:fuzztest", #添加DTFuzz用例路径
"//test/developertest/examples/detector/test:unittest",
"//test/developertest/examples/sleep/test:performance",
"//test/developertest/examples/distributedb/test:distributedtest"
"//test/developer_test/examples/calculator/test:unittest",
"//test/developer_test/examples/calculator/test:fuzztest", #添加DTFuzz用例路径
"//test/developer_test/examples/detector/test:unittest",
"//test/developer_test/examples/sleep/test:performance",
"//test/developer_test/examples/distributedb/test:distributedtest"
]
```
@ -228,7 +228,7 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or
Fuzz能力集成在测试类型-t中新增FUZZ类型执行Fuzz测试指令示例其中-t为必选-ss和-tm为可选
```
run -t FUZZ -ss developertest -tm calculator
run -t FUZZ -ss developer_test -tm calculator
```
| 参数 | 描述 | 说明 | 备注 |

View File

@ -70,7 +70,7 @@ CMD_KEY_SUBSYSTEMLIST_ACTS = "actssubsystemlist"
# hats子系统名称列表
CMD_KEY_SUBSYSTEMLIST_HATS = "hatssubsystemlist"
TOOL_VERSION_INFO = """Welcome to DeveloperTest V3.2.2.0
TOOL_VERSION_INFO = """Welcome to developer_test V3.2.2.0
"""
HLEP_COMMAND_INFOMATION = """use help [follow command] for more information:

View File

@ -38,7 +38,7 @@ class Gen(object):
def gen_fuzzer_list_file(self, fuzzer_list):
filepath = os.path.join(sys.source_code_root_path, "test",
"developertest", "libs", "fuzzlib", "fuzzer_list.txt")
"developer_test", "libs", "fuzzlib", "fuzzer_list.txt")
LOG.info("The fuzzer list file path: %s" % filepath)
with open(filepath, "w") as gn_file:
gn_file.truncate(0)

View File

@ -25,8 +25,8 @@ from core.constants import ConfigFileConst
LOG = platform_logger("config_manager")
# 变量注释 framework_res_dir = OpenHarmony/test/developertest
# 变量注释 CONFIG_PATH = OpenHarmony/test/developertest/config
# 变量注释 framework_res_dir = OpenHarmony/test/developer_test
# 变量注释 CONFIG_PATH = OpenHarmony/test/developer_test/config
CONFIG_PATH = os.path.join(sys.framework_res_dir, "config")
@ -36,7 +36,7 @@ class FrameworkConfigManager(object):
def __init__(self, filepath=""):
if filepath == "":
# 变量注释 filepath = OpenHarmony/test/developertest/config/framework_config.xml
# 变量注释 filepath = OpenHarmony/test/developer_test/config/framework_config.xml
self.filepath = os.path.abspath(os.path.join(
CONFIG_PATH, ConfigFileConst.FRAMECONFIG_FILEPATH))
else:
@ -96,7 +96,7 @@ class FilterConfigManager(object):
def __init__(self, filepath=""):
if filepath == "":
# 变量注释 filepath = OpenHarmony/test/developertest/config/filter_config.xml
# 变量注释 filepath = OpenHarmony/test/developer_test/config/filter_config.xml
self.filepath = os.path.abspath(
os.path.join(CONFIG_PATH,
ConfigFileConst.FILTERCONFIG_FILEPATH))
@ -165,7 +165,7 @@ class UserConfigManager(object):
def __init__(self, config_file=""):
if config_file == "":
# 变量注释 filepath = OpenHarmony/test/developertest/config/user_config.xml
# 变量注释 filepath = OpenHarmony/test/developer_test/config/user_config.xml
self.filepath = os.path.abspath(os.path.join(
CONFIG_PATH, ConfigFileConst.USERCONFIG_FILEPATH))
else:
@ -286,7 +286,7 @@ class BuildConfigManager(object):
def __init__(self, filepath=""):
if filepath == "":
# 变量注释 filepath = OpenHarmony/test/developertest/config/build_config.xml
# 变量注释 filepath = OpenHarmony/test/developer_test/config/build_config.xml
self.filepath = os.path.abspath(os.path.join(
CONFIG_PATH, ConfigFileConst.BUILDCONFIG_FILEPATH))
else:
@ -315,7 +315,7 @@ class FuzzerConfigManager(object):
def __init__(self, config_path=""):
if config_path == "":
# 变量注释 filepath = OpenHarmony/test/developertest/config/fuzz_config.xml
# 变量注释 filepath = OpenHarmony/test/developer_test/config/fuzz_config.xml
self.filepath = self.filepath = os.path.abspath(os.path.join(
CONFIG_PATH, ConfigFileConst.FUZZCONFIG_FILEPATH))
else:

View File

@ -804,7 +804,7 @@ class JSUnitTestDriver(IDriver):
def __execute__(self, request):
try:
LOG.info("developertest driver")
LOG.info("developer_test driver")
self.config = request.config
self.config.target_test_path = DEFAULT_TEST_PATH
self.config.device = request.config.environment.devices[0]

View File

@ -23,7 +23,7 @@ def _init_global_config():
# insert src path for loading xdevice modules
# 当前脚本运行的绝对路径 去掉最后两个路径
# 变量注释 framework_src_dir = OpenHarmony/test/developertest
# 变量注释 framework_src_dir = OpenHarmony/test/developer_test
sys.framework_src_dir = os.path.abspath(os.path.dirname(
os.path.dirname(__file__)))
@ -31,7 +31,7 @@ def _init_global_config():
sys.path.insert(0, sys.framework_src_dir)
# 当前脚本运行的绝对路径 去掉最后两个路径
# 变量注释 framework_root_dir = OpenHarmony/test/developertest
# 变量注释 framework_root_dir = OpenHarmony/test/developer_test
sys.framework_root_dir = os.path.abspath(os.path.dirname(
os.path.dirname(os.path.dirname(__file__))))
@ -53,14 +53,14 @@ def _init_global_config():
"src"))
sys.path.insert(1, sys.xdevice_extension_dir)
# 变量注释 pytest_dir = OpenHarmony/test/developertest/aw/python
# 变量注释 pytest_dir = OpenHarmony/test/developer_test/aw/python
sys.pytest_dir = os.path.abspath(os.path.join(
sys.framework_root_dir,
"aw",
"python"))
sys.path.insert(2, sys.pytest_dir)
# 变量注释 adapter_dir = OpenHarmony/test/developertest/adapter/aw/python
# 变量注释 adapter_dir = OpenHarmony/test/developer_test/adapter/aw/python
sys.adapter_dir = os.path.abspath(os.path.join(
sys.framework_root_dir,
"adapter"
@ -68,16 +68,16 @@ def _init_global_config():
"python"))
sys.path.insert(3, sys.adapter_dir)
# 变量注释 hmh_script = OpenHarmony/test/developertest/libs
# 变量注释 hmh_script = OpenHarmony/test/developer_test/libs
sys.hmh_script = os.path.abspath(os.path.join(
sys.framework_root_dir,
"libs"))
sys.path.insert(4, sys.hmh_script)
# 变量注释 framework_res_dir = OpenHarmony/test/developertest
# 变量注释 framework_res_dir = OpenHarmony/test/developer_test
sys.framework_res_dir = sys.framework_root_dir
# 变量注释 exec_dir = OpenHarmony/test/developertest
# 变量注释 exec_dir = OpenHarmony/test/developer_test
sys.exec_dir = sys.framework_root_dir
from core.common import get_source_code_root_path