自学内容网 自学内容网

【OpenHarmony】TDD-FUZZ环境配置

零、参考

1、AttributeError: ‘ElementTree‘ object has no attribute ‘getiterator‘:https://blog.csdn.net/suhao0911/article/details/110950742

一、创建工作目录

1、新建工作目录如:D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz。
2、gitee上下载 testfwk_developer_test-master、testfwk_xdevice-master。
3、将developer_test、xdevice压缩包解压到 D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz,并且目录重命名为developer_test、xdevice(必须重命名为xdevice)
https://gitee.com/openharmony/testfwk_xdevice/blob/master/config/user_config.xml

二、创建测试套目录 tests

在工作目录D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz下创建目录 tests用于存放 tdd、fuzz用例。
配置D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz\developer_test\config\usr_config.xml(指定test_cases为D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz\tests

三、下载TDD、FUZZ测试套

tdd、fuzz用例从版本里取构建详情 (openharmony.cn)  :http://ci.openharmony.cn/workbench/cicd/dailybuild/detail/component

四、执行TDD、FUZZ测试

常用TDD测试命令

run -t UT -ts screen_capture_capi_unit_test
run -t UT -ts screen_capture_native_unit_test

run -t UT -ts screen_capture_capi_unit_test -tc ScreenCaptureUnitTest.screen_capture_save_file_02
run -t UT -ts screen_capture_capi_unit_test -tc ScreenCaptureUnitTest.screen_capture_specified_window_cb_01
run -t UT -ts screen_capture_capi_unit_test -tc ScreenCaptureUnitTest.screen_capture_save_file_cb_01
run -t UT -ts screen_capture_capi_unit_test -tc ScreenCaptureUnitTest.screen_capture_save_file_04

run -t UT -ts screen_capture_native_unit_test -tc ScreenCaptureUnitTest.screen_capture_specified_window_cb_01
run -t UT -ts screen_capture_native_unit_test -tc ScreenCaptureUnitTest.screen_capture_save_file_cb_01
run -t UT -ts screen_capture_native_unit_test -tc ScreenCaptureUnitTest.screen_capture_specified_window

TDD执行

run -t UT
run -t UT -ts screen_capture_capi_unit_test
run -t UT -ts screen_capture_capi_unit_test -tc ScreenCaptureUnitTest.screen_capture_specified_window_cb_01

FUZZ执行

run -t FUZZ
run -t FUZZ -ts PlayerStubFuzzTest
run -t FUZZ -ts PlayerStubFuzzTest -tc xxxxx.xxxx

问题1、exception: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

Python版本问题(3.9 删除了getiterator接口,变成了iter):
[2023-08-31 10:14:01,189] [196804] [Concurrent] [ERROR] [Device: 150100424a************834bfb4900, exception: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'] [ErrorNo=00000]
[2023-08-31 10:14:01,190] [196804] [Concurrent] [INFO] [Executed: D:\0000_TDD_FUZZ\0000_ohos_tdd_fuzz\tests\fuzztest\player_framework\recorder\RecorderSetVideoSizeFuzzTest, Execution Time: 2sec]

全局搜索getiterator:grep -rns getiterator。将存在getiterator 的py文件里的getiterator替换为 iter。
developer_test/src/core/config/resource_manager.py:100:                targets = root.getiterator("target")
Binary file developer_test/src/core/config/__pycache__/resource_manager.cpython-311.pyc matches
Binary file developer_test/src/core/config/__pycache__/resource_manager.cpython-39.pyc matches
xdevice/src/xdevice/_core/config/resource_manager.py:83:                targets = root.getiterator("target")
Binary file xdevice/src/xdevice/_core/config/__pycache__/resource_manager.cpython-311.pyc matches
Binary file xdevice/src/xdevice/_core/config/__pycache__/resource_manager.cpython-39.pyc matches

全局搜索getiterator:grep -rns getiterator。将存在getiterator 的py文件里的getiterator替换为 iter。

developer_test/src/core/config/resource_manager.py:100:                targets = root.getiterator("target")

Binary file developer_test/src/core/config/__pycache__/resource_manager.cpython-311.pyc matches

Binary file developer_test/src/core/config/__pycache__/resource_manager.cpython-39.pyc matches

xdevice/src/xdevice/_core/config/resource_manager.py:83:                targets = root.getiterator("target")

Binary file xdevice/src/xdevice/_core/config/__pycache__/resource_manager.cpython-311.pyc matches

Binary file xdevice/src/xdevice/_core/config/__pycache__/resource_manager.cpython-39.pyc matches


原文地址:https://blog.csdn.net/jinghuaboy/article/details/137756444

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!