Java 如何在Eclipse中运行JUnit5测试

Java 如何在Eclipse中运行JUnit5测试,java,eclipse,junit,junit5,Java,Eclipse,Junit,Junit5,我想在Eclipse中运行JUnit测试。我试过这个: 我添加了POM依赖项: <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.1.0</version> <scope&g

我想在Eclipse中运行JUnit测试。我试过这个:

我添加了POM依赖项:

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.1.0</version>
        <scope>test</scope>
    </dependency>
但当我运行测试时,我得到:

Aug 24, 2018 12:29:23 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.rest.api.DatabaseFeaturesTest
Aug 24, 2018 12:29:23 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.rest.api.DatabaseFeaturesTest

你能给我一些建议吗?我哪里错了以及如何解决这个问题?

摆脱
@RunWith(JUnitPlatform.class)
,这是JUnit4运行Jupiter测试的方法。有了Eclipse中的JUnit5平台支持,您就不再需要它了

摆脱
@RunWith(JUnitPlatform.class)
,这是JUnit4运行Jupiter测试的方法。有了Eclipse中的JUnit5平台支持,您就不再需要它了

您正在运行哪个版本的Eclipse?根据EclipseOxygen.1a(4.7.1a)中添加的JUnit5支持,我使用版本:Photon Release(4.8.0)@johanneslink的答案是正确的:您不需要
@RunWith(JUnitPlatform.class)
在Eclipse4.7.1a或更高版本中运行基于JUnit5的测试。所以,我建议你接受他的回答您正在运行哪个版本的Eclipse?根据EclipseOxygen.1a(4.7.1a)中添加的JUnit5支持,我使用版本:Photon Release(4.8.0)@johanneslink的答案是正确的:您不需要
@RunWith(JUnitPlatform.class)
在Eclipse4.7.1a或更高版本中运行基于JUnit5的测试。所以,我建议你接受他的回答
Aug 24, 2018 12:29:23 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.rest.api.DatabaseFeaturesTest
Aug 24, 2018 12:29:23 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.rest.api.DatabaseFeaturesTest