文档介绍:该【JUnit测试公开课一等奖课件赛课获奖课件 】是由【梅花书斋】上传分享,文档一共【42】页,该文档可以免费在线阅读,需要了解更多关于【JUnit测试公开课一等奖课件赛课获奖课件 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。软件测试技术基础
单元测试工具JUnit
Review
软件测试目的
软件测试的过程
单元测试的流程
教学
目标
教学
目标
理解JUnit测试流程
理解JUnit的测试环境
理解JUnit测试中常用的措施
技能
要求
学会用JUnit对java程序进行单元测试
单元测试工具JUnit
理解JUnit的基本知识
理解JUnit的安装
理解JUnit的测试框架
JUnit的使用
JUnit的安装
JUnit概述
单元测试工具JUnit
知识的分析
重点:
JUnit测试异常
断言的使用
JUnit基本概念
JUnit常用类(TestCase、Assert、TestSuite)的使用
难点:
The Testing Problems
programmers
Should write
few
Do
Why?
I am so busy
It is difficult
The Testing Problems
Programmers need such kind of tool:
“Writing a few lines of code, then a test that should run, or even better, to write a test that won't run, then write the code that will make it run.”
JUnit is that kind of tool!
一种简单的例子
int add(int a, int b)
{
return a+b;
}
功能?
JUnit概述
public class FirstTestExample {
int add(int a, int b)
{
return a+b;
}
public static void main(String[] args) {
FirstTestExample fta=new FirstTestExample();
("Add value is:"+(2,3));
}
}
Java测试代码
JUnit概述
import ;
public class FirstTestExampleTest extends TestCase {
public void testAdd()
{
assertEquals(3,new FirstTestExample().add(2,3));
}
}
JUnit概述
JUnit测试代码