本文介绍了在Intellij上运行测试:未找到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在评估IntelliJ(13.0.2 133.696),无法从IDE中运行jUnit测试。 我的项目是一个多模块gradle项目,使用scala。 测试类位于src / test / scala / xxx / xxxxx / xxx / xxxx / xxxxx下,每次我尝试从IDE运行时,都会得到相同的错误: 未找到类别:xxx.xxxxx.xxx.xxxx.xxxxx.AccountRepositoryTest 测试类没什么特别,简单的jUnit测试: @ContextConfiguration(class = Array(classOf [DataConfig],classOf [SettingsConfig])) class AccountRepositoryTest扩展AssertionsForJUnit { 我发现了一个相关的问题,但提供的修复(升级到13.0.2) 我甚至试着升级到最新的EAP,仍然是同样的问题。解决方案 为了修复它,我创建了一个在我的项目根目录下设置 classes 目录,并将项目编译器输出设置为绝对路径(使用 ... 按钮浏览)。 I'm evaluating IntelliJ (13.0.2 133.696) and cannot get jUnit tests to run from within the IDE.My project is a multi module gradle project and uses scala.Test class is located under src/test/scala/xxx/xxxxx/xxx/xxxx/xxxxx and everytime i try to run from IDE i get the same error:Class not found: "xxx.xxxxx.xxx.xxxx.xxxxx.AccountRepositoryTest"Test class is nothing fancy, simple jUnit test:@RunWith(classOf[SpringJUnit4ClassRunner])@ContextConfiguration(classes = Array(classOf[DataConfig], classOf[SettingsConfig]))class AccountRepositoryTest extends AssertionsForJUnit {I've found a related question Cannot run Junit tests from IDEA 13.0 IDE for imported gradle projects , but the provided fix (upgrade to 13.0.2) does not work.I've even tried upgrading to the latest EAP, still the same issue. 解决方案 I had this same problem, and in my case the problem was due to the "Project compiler output" path being left blank in Project Settings.To fix it I created a classes directory in my project root, and set Project compiler output to the absolute path (use the … button to browse). 这篇关于在Intellij上运行测试:未找到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!