【发布时间】:2020-08-06 11:14:44
【问题描述】:
我的 Spring Boot 应用程序有几个测试类。
当右键单击一个测试类并选择Run XYZtest 选项时,它可以正常工作。
But when selecting the folder that contains that class and selecting Run test in com.example.my I get an error of No junit.jar:
当从 mvn 运行所有测试时,它们运行没有问题。
根据一些建议,我专门在Library 部分添加了junit.jar,但没有帮助:
【问题讨论】:
-
Try Invalidate Cache and Restart File > Invalidate Caches/Restart... 另外,尝试重新加载 maven 项目。
-
@rimonmostafiz 是的。我试过了,但没有用。
-
确保你有正确版本的junit库添加到你有junit测试的每个模块的依赖项中。如果是基于 Maven 的项目 - 检查每个模块的 pom.xml 文件中是否存在 junit 依赖项。
标签: java intellij-idea junit