Description: JUNIT Test is a important test method for unit test to assure the programing quality. Parameterization of Junit Test can reduce the complexity and enhance the flexibility. Following is the basic steps for parameterization:
(1) import the relative class:
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
(2) Present annotation:
@RunWith(Parameterized.class)
(3)Coding the method,such as:
@Parameters
public static Collection words(){
return Arrays.asList(new Object[][]{
{"","",2}, //测试无输入
{"2010-01-01", "2010-02-01",0} , //测试无返回结果
{"2010-07-01", "2010-07-31",2} //测试有返回结果
})
}
To Search:
File list (Check if you may need any files):
testsrc\com\bocsoft\cibs\cash\fake\AllTests1.java
.......\...\.......\....\....\....\BfwTest.java
.......\...\.......\....\....\....\DummyContext.java
.......\...\.......\....\....\....\FakeCashPeopleSubmitOutStoreTest.java
.......\...\.......\....\....\fake
.......\...\.......\....\cash
.......\...\.......\cibs
.......\...\bocsoft
.......\com
testsrc