在JUnit中,可以使用@RunWith
和@Suite
批注运行多个测试用例。 请参考以下示例:
SuiteAbcTest.java
package com.mkyong;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
Exception1Test.class, //test case 1
TimeoutTest.class //test case 2
})
public class SuiteAbcTest {
//normally, this is an empty class
}
PS已通过JUnit 4.12测试