如何在 IntelliJ IDEA v2016.2.2 中使用 JUnit 5 执行所有套件测试?
我得到运行此代码的空测试套件:
import org.junit.platform.runner.IncludeEngines;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.runner.SelectPackages;
import org.junit.runner.RunWith;
@RunWith(JUnitPlatform.class)
@IncludeEngines("junit-jupiter")
@SelectPackages("<eu...package>") //I confirm that <eu...package> is ok.
public class AllTests {
}
我收到:
INFORMAZIONI: Discovered TestEngines with IDs: [junit-jupiter, junit-vintage]
Empty test suite.
Empty test suite.
[root]
JUnit Jupiter
JUnit Vintage
或者
import eu.....services.ServiceTest;
import eu.....repository.DAOTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
ServiceTest.class,
DAOTest.class
})
public class AllTests {
}
我收到:
INFORMAZIONI: Discovered TestEngines with IDs: [junit-jupiter, junit-vintage]
Empty test suite.
[root]
|+--JUnit Vintage
| +--eu.....AllTests
|+--JUnit Jupiter
我能够使用 JUnit 4 运行套件,但它不适用于 JUnit 5。