Top

springboot,springboot2 No tests found matching [{ExactMatcher:fDisplayName=test], {ExactMatcher:fDisplayName=test

资讯 浏览 评论


springboot2运行测试报错如下:

java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test], {ExactMatcher:fDisplayName=test(com.example.demo.ApplicationTests)], {LeadingIdentifierMatcher:fClassName=com.example.demo.ApplicationTests,fLeadingIdentifier=test]] from org.junit.internal.requests.ClassRequest@29b5cd00

at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:83)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:74)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:49)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)


原因是测试类中注解@SpringBootTest后面要加入口类:@SpringBootTest(classes = { Application.class })



    与本文相关的文章