JUnit 4具有参数化测试,它与php数据提供程序具有相同的作用
@RunWith(Parameterized.class)public class MyTest{ @Parameters public static Collection<Object[]> data() { } private int a,b,c; public MyTest(int a, int b, int c) { this.a= a; this.b = b; this.c = c; } @Test public void test() { //do your test with a,b } @Test public void testC(){ //you can have multiple tests //which all will run //...test c }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)