diff --git a/zh-cn/application-dev/application-test/arkxtest-guidelines.md b/zh-cn/application-dev/application-test/arkxtest-guidelines.md index 8d31275f5d196b82a936c82c11baa53a17eefa9d..f79e8b5cce3c66e0c16b140c64c16326d76aade3 100644 --- a/zh-cn/application-dev/application-test/arkxtest-guidelines.md +++ b/zh-cn/application-dev/application-test/arkxtest-guidelines.md @@ -58,7 +58,7 @@ DevEco Studio可参考其官网介绍进行[下载](https://developer.harmonyos. ## 新建测试脚本 1. 在DevEco Studio中新建应用开发工程,其中ohos目录即为测试脚本所在的目录。 -2. 在工程目录下打开待测试模块下的ets文件,将光标置于代码中任意位置,单击**右键 > Show Context Actions** **> Create Ohos Test**或快捷键**Alt+enter** **> Create Ohos Test**创建测试类,更多指导请参考DevEco Studio中[指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-openharmony-test-framework-0000001267284568)。 +2. 在工程目录下打开待测试模块下的ets文件,将光标置于代码中任意位置,单击**右键 > Show Context Actions** **> Create Ohos Test**或快捷键**Alt+enter** **> Create Ohos Test**创建测试类,更多指导请参考DevEco Studio中[指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-openharmony-test-framework-0000001263160453)。 ## 编写单元测试脚本 @@ -197,7 +197,8 @@ export default function abilityTest() { | breakOnError | 遇错即停模式,当执行用例断言失败或者发生错误时,退出测试执行流程 | true/false(默认值) | -s breakOnError true | | testType | 指定要执行用例的用例类型 | function,performance,power,reliability, security,global,compatibility,user,standard,safety,resilience' | -s testType function | | level | 指定要执行用例的用例级别 | 0,1,2,3,4 | -s level 0 | -| size | 指定要执行用例的用例规模 | small,medium,large | -s size small | +| size | 指定要执行用例的用例规模 | small,medium,large | -s size small +| stress | 指定要执行用例的执行次数 | 正整数 | -s stress 1000 | **通过在cmd窗口直接执行命令。** @@ -266,6 +267,12 @@ export default function abilityTest() { hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s size small ``` +**示例代码11**:执行测试用例指定次数。 + +```shell + hdc shell aa test -b xxx -p xxx -s unittest OpenHarmonyTestRunner -s stress 1000 +``` + **查看测试结果** - cmd模式执行过程,会打印如下相关日志信息。 @@ -412,11 +419,11 @@ UI测试用例执行失败,查看hilog日志发现日志中有“uitest-api do 2.避免多进程执行UI测试用例。 -**3、失败日志有“dose not exist on current UI! Check if the UI has changed after you got the widget object”错误信息** +**3、失败日志有“does not exist on current UI! Check if the UI has changed after you got the widget object”错误信息** **问题描述** -UI测试用例执行失败,查看hilog日志发现日志中有“dose not exist on current UI! Check if the UI has changed after you got the widget object”错误信息。 +UI测试用例执行失败,查看hilog日志发现日志中有“does not exist on current UI! Check if the UI has changed after you got the widget object”错误信息。 **可能原因** diff --git a/zh-cn/application-dev/application-test/figures/Execute.PNG b/zh-cn/application-dev/application-test/figures/Execute.PNG index 49155c9b3406ea477e08273818e52fe026a62737..7c9d9be0d39c8b07c32f351622423085a4086584 100644 Binary files a/zh-cn/application-dev/application-test/figures/Execute.PNG and b/zh-cn/application-dev/application-test/figures/Execute.PNG differ diff --git a/zh-cn/application-dev/application-test/figures/TestResult.PNG b/zh-cn/application-dev/application-test/figures/TestResult.PNG index 300266842efab6da7a4f7469ab8c9e890f238b89..c2938e7f8fbd4ec112506db5b9b9ac03a7b42397 100644 Binary files a/zh-cn/application-dev/application-test/figures/TestResult.PNG and b/zh-cn/application-dev/application-test/figures/TestResult.PNG differ