问题
When I run a simple example like the eclipse plug-in test, I get the following error:
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=test], {ExactMatcher:fDisplayName=test(ru.cft.platform.deployment.ui.plugin.reverse.qqq)], {LeadingIdentifierMatcher:fClassName=ru.cft.platform.deployment.ui.plugin.reverse.qqq,fLeadingIdentifier=test]] from org.junit.internal.requests.ClassRequest@310850ef
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createFilteredTest(JUnit4TestLoader.java:80)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:71)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:46)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:522)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:181)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:43)
at java.lang.Thread.run(Thread.java:745)
If I run the example as a normal junit test, then everything runs without problems.
What am I doing wrong? There is a need to run it through JUnitPlatform
, to use the Suite.
Edit:
package sss;
import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
@RunWith(JUnitPlatform.class)
public class test {
@Test
@DisplayName("My First Test")
public void test() {
fail("Not yet implemented");
}
}
来源:https://stackoverflow.com/questions/49143043/running-eclipse-junit-plug-in-tests-using-junit5