软件测试-junit
软件测试 SOUTHEAST UNIVERSITY
Software Testing
软件测试基础与实践
Software Testing: Foundations and Practices
第5讲 JUnit测试工具
:
教师 汪鹏 廖?
软件工程专业 主干课程
汪 鹏
2014年11月27日
东南大学 软件学院 College of Software Engineering
如何有效测试软件p>
测试?例:输?,执?条件,期望输出
??输?p>
??观察输出p>
??统计测试结果p>
程序可能不断被修改!
修改的程序需要不断被测试!
??执?上述测试步骤可?吗p>
?项?开发中的测试?作量p>
?动化测试p>
回归测试014年11月27日
2 东南大学 软件学院 College of Software Engineering
JUnit之前的单元测试
public class Car {
public int getWheels (){
return 4;
}
}
public class TestCar {
public static void main(String[] args) {
Car car = new Car();
if (4 == car.getWheels())
System.out.println(“Ok!”);
else
System.out.println(“Error!”);
}
}
2014年11月27日
3 东南大学 软件学院 College of Software Engineering
JUnit — TestCase
import junit.framework.TestCase ;
public class Test extends TestCase {
public Test(String name) {
super(name);
}
public void setUp() {}
public void tearDown(){}
public void testgetWheels() {
// Test Code goes here
Car car = new Car();
assertEquals(4, car.getWheels());
}
}
文章知识点与官方知识档案匹配,可进一步学习相关知识Java技能树首页概览93765 人正在系统学习中 相关资源: Junit实战第二版 中文完整版.pdf
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!