文件名称:testsrc
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:2.98kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
利用JUNIT实现单元测试,是提高单元测试效率和质量的重要方法 而参数化的单元测试对于测试覆盖型\案例灵活性具有重要作用. 参数化测试的基本步骤包括:
(1) 引用参数化的相关类,如:
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
(2) 在测试类中增加注解:
@RunWith(Parameterized.class)
(3)增加参数方法:
@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} //测试有返回结果
})
}-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} //测试有返回结果
})
}
(1) 引用参数化的相关类,如:
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
(2) 在测试类中增加注解:
@RunWith(Parameterized.class)
(3)增加参数方法:
@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} //测试有返回结果
})
}-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} //测试有返回结果
})
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
testsrc/com/bocsoft/cibs/cash/fake/AllTests1.java
testsrc/com/bocsoft/cibs/cash/fake/BfwTest.java
testsrc/com/bocsoft/cibs/cash/fake/DummyContext.java
testsrc/com/bocsoft/cibs/cash/fake/FakeCashPeopleSubmitOutStoreTest.java
testsrc/com/bocsoft/cibs/cash/fake
testsrc/com/bocsoft/cibs/cash
testsrc/com/bocsoft/cibs
testsrc/com/bocsoft
testsrc/com
testsrc
testsrc/com/bocsoft/cibs/cash/fake/BfwTest.java
testsrc/com/bocsoft/cibs/cash/fake/DummyContext.java
testsrc/com/bocsoft/cibs/cash/fake/FakeCashPeopleSubmitOutStoreTest.java
testsrc/com/bocsoft/cibs/cash/fake
testsrc/com/bocsoft/cibs/cash
testsrc/com/bocsoft/cibs
testsrc/com/bocsoft
testsrc/com
testsrc
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.