我正在尝试在IntelliJ上使用scalatest运行单元测试。但是我遇到了这个错误
Unable to load a Suite class. This could be due to an error in your runpath. Missing class com.serviceyou.com.tests.ServiceYouTest
java.lang.ClassNotFoundException: com.serviceyou.com.tests.ServiceYouTest
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$6(Runner.scala:1213)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$6$adapted(Runner.scala:1211)
at scala.collection.TraversableLike.$anonfun$filterImpl$1(TraversableLike.scala:248)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.collection.TraversableLike.filterImpl(TraversableLike.scala:247)
at scala.collection.TraversableLike.filterImpl$(TraversableLike.scala:245)
at scala.collection.AbstractTraversable.filterImpl(Traversable.scala:104)
at scala.collection.TraversableLike.filter(TraversableLike.scala:259)
at scala.collection.TraversableLike.filter$(TraversableLike.scala:259)
at scala.collection.AbstractTraversable.filter(Traversable.scala:104)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1211)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1506)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
我看着“编辑配置”,看起来不错。 此外,测试可以在命令行上成功运行,但不能在IntelliJ上运行。
此外,我尝试查看其他人在堆栈溢出时遇到了什么,但是没有任何建议可以解决该问题。