用途:面向 OpenHarmony C/C++ 代码生成单元测试(HWTEST/HWTEST_F)及 ohos_unittest 编译配置,用于子系统、模块、文件或函数的测试创建。
主要能力:按流程输出环境确认、源码分析报告、测试策略、场景设计、用例规划、测试文件与 BUILD.gn,并给出编译验证命令。
关键约束:必须包含 using namespace testing::ext;;使用 HWTEST/HWTEST_F 而非原生 TEST/TEST_F,并指定 TestSize.Level1-4;BUILD.gn 首行需 import("//build/test.gni");module_out_path 使用“子系统名/模块名”;deps 需含 //third_party/googletest:gtest_main;访问 private 成员可用 -Dprivate=public -Dprotected=public。
分析存量测试脚本:python scripts/analyze-existing-tests.py <test_directory> --output style_report.md [--encoding utf-8] [--verbose]
验证命令:./build.sh --product-name <product> --build-target BBoxDetectorUnitTest
适用与限制:仅覆盖资料列出的 OpenHarmony 单元测试生成流程;其他平台、收费与价格等信息暂未提供。