由于vscode中开发java的环境不是特别满意:主要是 java language server 这个插件使用默认配置时常常崩溃(后来特别加大了Xmx设置才好一点)
前后多次调整vscode的插件的启用和禁用,以及java相关的设置。
突然发现所有的单元测试都报错如下:
Listening for transport dt_socket
address: 54564
Error occurred: {"name":"error", "
tributes":{"message":"No test found to run for suite com.mex.tianyi.service.sync.CampaignSyncServiceTest#sync. Details: com.mex.tianyi.service.sync.CampaignSyncServiceTest.", "details":"java.lang.ClassNotFoundException: com.mex.tianyi.service.sync.CampaignSyncServiceTest\r\n\t
CampaignSyncServiceTest
java.net.URLClassLoader.findClass(URLClassLoader.java:381)\r\n\t
java.lang.ClassLoader.loadClass(ClassLoader.java:424)\r\n\t
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)\r\n\t
java.lang.ClassLoader.loadClass(ClassLoader.java:357)\r\n\t
java.lang.Class.forName0(N
ive Method)\r\n\t
java.lang.Class.forName(Class.java:264)\r\n\t
com.microsoft.java.test.runner.TestRunnerUtil.getRequestForOneMethod(TestRunnerUtil.java:49)\r\n\t
com.microsoft.java.test.runner.TestRunnerUtil.cre
eTestReferences(TestRunnerUtil.java:40)\r\n\t
com.microsoft.java.test.runner.CustomizedJUnitCoreRunner.run(CustomizedJUnitCoreRunner.java:25)\r\n\t
com.microsoft.java.test.runner.JUnitLauncher.execute(JUnitLauncher.java:26)\r\n\t
com.microsoft.java.test.runner.JUnitLauncher.main(JUnitLauncher.java:15)\r\n"}}@@<TestRunner-{"name":"error", "
tributes":{"message":"No test found to run for suite com.mex.tianyi.service.sync.CampaignSyncServiceTest#sync. Details: com.mex.tianyi.service.sync.CampaignSyncServiceTest.", "details":"java.lang.ClassNotFoundException: com.mex.tianyi.service.sync.CampaignSyncServiceTest\r\n\t
java.net.URLClassLoader.findClass(URLClassLoader.java:381)\r\n\t
java.lang.ClassLoader.loadClass(ClassLoader.java:424)\r\n\t
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)\r\n\t
java.lang.ClassLoader.loadClass(ClassLoader.java:357)\r\n\t
java.lang.Class.forName0(N
ive Method)\r\n\t
java.lang.Class.forName(Class.java:264)\r\n\t
com.microsoft.java.test.runner.TestRunnerUtil.getRequestForOneMethod(TestRunnerUtil.java:49)\r\n\t
com.microsoft.java.test.runner.TestRunnerUtil.cre
eTestReferences(TestRunnerUtil.java:40)\r\n\t
com.microsoft.java.test.runner.CustomizedJUnitCoreRunner.run(CustomizedJUnitCoreRunner.java:25)\r\n\t
com.microsoft.java.test.runner.JUnitLauncher.execute(JUnitLauncher.java:26)\r\n\t
com.microsoft.java.test.runner.JUnitLauncher.main(JUnitLauncher.java:15)\r\n"}}-TestRunner>
no test found to run
好熟悉啊,以前也见过。
上一次重启vscode就好了啊。
这下重启几次都不行呢?咋回事啊?
仔细看看stack trace,no class found
?
突然想起来了之前嫌弃vscode每次修改完内容要保存时都会validate project 好几秒,很烦。然后自己修改了好多设置,其中就有disable atuo build
!
天哪,赶紧打开auto build
——终于不会出现上面的错误了!
原来是修改了单元测试代码后都没有自动编译嘛,连class都找不到!
网友评论