1b0e7dd80Sopenharmony_ci# pytest命令行参数 2b0e7dd80Sopenharmony_ci-s: 显示输出调试信息,包括print打印的信息 3b0e7dd80Sopenharmony_ci-v: 显示更详细的信息 4b0e7dd80Sopenharmony_ci-n:支持多线程运行脚本(需要保持用例彼此独立) 5b0e7dd80Sopenharmony_ci--reruns NUM:失败用例重跑次数 6b0e7dd80Sopenharmony_ci-x:表示只要有一个用例报错,那么测试停止 7b0e7dd80Sopenharmony_ci-k:模糊匹配字符串进行用例跑测 8b0e7dd80Sopenharmony_ci 9b0e7dd80Sopenharmony_ci# 目录结构 10b0e7dd80Sopenharmony_ci``` 11b0e7dd80Sopenharmony_ci/hitrace/test/scripts 12b0e7dd80Sopenharmony_ci├─reports # 测试报告目录 13b0e7dd80Sopenharmony_ci├─testModule 14b0e7dd80Sopenharmony_ci| ├─test_hitrace_cmd.py # 测试资源文件,存放测试过程中使用到的文件 15b0e7dd80Sopenharmony_ci├─main.py # 测试用例执行入口 16b0e7dd80Sopenharmony_ci├─pytest.ini # pytest配置文件 17b0e7dd80Sopenharmony_ci└─requirements.txt # 依赖文件 18b0e7dd80Sopenharmony_ci``` 19b0e7dd80Sopenharmony_ci 20b0e7dd80Sopenharmony_ci## 测试用例执行 21b0e7dd80Sopenharmony_ciwindows环境下执行测试用例: 22b0e7dd80Sopenharmony_ci进入scripts目录 23b0e7dd80Sopenharmony_ci### 方式一: 24b0e7dd80Sopenharmony_ci``` 25b0e7dd80Sopenharmony_ci python main.py 26b0e7dd80Sopenharmony_ci``` 27b0e7dd80Sopenharmony_ci 28b0e7dd80Sopenharmony_ci## 测试报告 29b0e7dd80Sopenharmony_ci执行python main.py后,会在reports目录下生成测试报告