项目中编写测试类,运行Run As —> Junit Test,会报错class not found。

class not found肯定是没有编译成功。project—>clean—>重新编译,还是报错。其实要运行Junit必须在target/test-classes找到编译类。

解决方法:
在pom.xml文件中,Run As —> maven test,会发现target/test-classes编译的类。console中可以看到运行maven test的相关信息或错误,在surefire-reports文件夹也可以找到编译的信息。这样再运行就可以了。
junit4报测试类class not found

相关文章:

  • 2021-07-23
  • 2021-06-24
  • 2021-03-31
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
猜你喜欢
  • 2021-09-28
  • 2022-12-23
  • 2021-05-27
  • 2021-06-08
  • 2022-12-23
  • 2021-08-15
  • 2021-04-03
相关资源
相似解决方案