在參數化類中運行的junit測試類中,我可以使用多個@Parameters方法嗎?@ Junit 4中的參數
@RunWith(value = Parameterized.class)
public class JunitTest6 {
private String str;
public JunitTest6(String region, String coverageKind,
String majorClass, Integer vehicleAge, BigDecimal factor) {
this.str = region;
}
@Parameters
public static Collection<Object[]> data1() {
Object[][] data = {{some data}}
return Arrays.asList(data);
}
@Test
public void pushTest() {
System.out.println("Parameterized str is : " + str);
str = null;
}
@Parameters
public static Collection<Object[]> data() {
Object[][] data = {{some other data}}
return Arrays.asList(data);
}
@Test
public void pullTest() {
System.out.println("Parameterized new str is : " + str);
str = null;
}
}
是的,這可能是解決方案,謝謝Yishai。 – ravinikam 2009-10-07 14:20:09