Intellij Idea 错误ID为“junit-vintage”的TestEngine在使用Intellij时未能发现测试

fcwjkofz  于 2022-12-03  发布在  其他
关注(0)|答案(1)|浏览(161)

我正在做一个小组项目,试图运行一个测试。运行时,我在文件中得到了错误沿着org.junit.platform.commons.util.PreconditionViolationException:无法加载名为的类...
我尝试过使缓存无效并重新启动,也尝试过重新导入pom.xml文件,但在尝试运行测试时仍然出现错误。
任何帮助都将不胜感激。
我正在使用IntelliJ IDEA 2019.2.4(社区版)
Intellij显示的错误

WARNING: TestEngine with ID 'junit-vintage' failed to discover tests
org.junit.platform.commons.util.PreconditionViolationException: Could not load class with name: <ommitted>
    at org.junit.platform.engine.discovery.MethodSelector.lambda$lazyLoadJavaClass$0(MethodSelector.java:156)
    at java.base/java.util.Optional.orElseThrow(Optional.java:408)
    at org.junit.platform.engine.discovery.MethodSelector.lazyLoadJavaClass(MethodSelector.java:155)
    at org.junit.platform.engine.discovery.MethodSelector.getJavaClass(MethodSelector.java:135)
    at org.junit.vintage.engine.discovery.MethodSelectorResolver.resolve(MethodSelectorResolver.java:34)
    at org.junit.vintage.engine.discovery.MethodSelectorResolver.lambda$resolve$0(MethodSelectorResolver.java:30)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
    at org.junit.vintage.engine.discovery.MethodSelectorResolver.resolve(MethodSelectorResolver.java:30)
    at org.junit.vintage.engine.discovery.VintageDiscoverer.collectTestClasses(VintageDiscoverer.java:64)
    at org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:51)
    at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:61)
    at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168)
    at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
mnemlml8

mnemlml81#

如果你不使用'junit-vintage'是最好从springboot依赖...在一些版本中,这个模块是不执行...为我解决。
请参阅此问题:spring-boot-starter-test with JUnit 5

相关问题