spring 用Junit报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37788081/article/details/82811058

在用pring中的Junit做单元测试是出现下面这种错误。。。

org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
九月 22, 2018 11:22:08 上午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@73f792cf, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2ed94a8b, org.springframework.test.context.support.DirtiesContextTestExecutionListener@38082d64, org.springframework.test.context.transaction.TransactionalTestExecutionListener@dfd3711, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@42d3bd8b]

java.lang.Exception: No tests found matching Method fun5(jdbcDemo1.Demo) from org.junit.internal.requests.ClassRequest@26ba2a48

	at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
	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)

原因就是…
手贱把方法上面的@Test给漏掉了。。。。

猜你喜欢

转载自blog.csdn.net/qq_37788081/article/details/82811058