HarmonyOS 鸿蒙Next执行单元测试报错

发布于 1周前 作者 yibo5220 最后一次编辑是 5天前 来自 鸿蒙OS

HarmonyOS 鸿蒙Next执行单元测试报错

写了一个简单的测试,运行是提示如下错误 DevEco Studio

错误如下:


ERROR: Failed :entry:ohosTest@OhosTestCompileArkTS 

> hvigor ERROR: Could not resolve “./src/main/core from oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:16:18

 Cannot find module ‘./src/main/core or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:17:46

 Cannot find module ‘./src/main/Constant or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:18:24

 Cannot find module ‘./src/main/module/config/DataDriver or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:19:26

 Cannot find module ‘./src/main/module/assert/ExpectExtend or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:20:22

 Cannot find module ‘./src/main/module/report/OhReport or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:21:24

 Cannot find module ‘./src/main/module/kit/SysTestKit or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:22:80

 Cannot find module ‘./src/main/interface or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:23:29

 Cannot find module ‘./src/main/module/mock/MockKit or its corresponding type declarations.

ERROR: ArkTS:ERROR File: H:/harmonyOS4/oh_modules/.ohpm/@ohos+hypium@1.0.6/oh_modules/@ohos/hypium/index.ets:24:30

 Cannot find module ‘./src/main/module/mock/ArgumentMatchers or its corresponding type declarations.

感觉是找不到响应的模块


更多关于HarmonyOS 鸿蒙Next执行单元测试报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html

2 回复

针对HarmonyOS(鸿蒙)Next执行单元测试报错的问题,首先请确保你的开发环境(如DevEco Studio)和鸿蒙SDK已更新至最新版本。其次,检查单元测试的配置文件(如build.gradle或tests.yaml)是否正确无误,特别是依赖项和测试框架的配置。此外,查看具体的错误信息和堆栈跟踪,这通常能指示出问题的根源,比如是代码问题、资源缺失还是配置错误。最后,确保测试用例本身编写正确,符合鸿蒙单元测试的要求。如果问题依旧没法解决请加我微信,我的微信是itying888。

更多关于HarmonyOS 鸿蒙Next执行单元测试报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


更多关于HarmonyOS 鸿蒙Next执行单元测试报错的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


学一下这个HarmonyOS纯血鸿蒙教程就会了https://www.bilibili.com/video/BV1fw2ZYSEk2

回到顶部
AI 助手
你好,我是IT营的 AI 助手
您可以尝试点击下方的快捷入口开启体验!