Unit单元测试框架.ppt

第九章 JUnit单元测试框架 上节回顾: JUnit已经13岁了,是由Erich Gamma 和 Kent Beck 为 Java 语言创建了一个简单但有效的单元测试框架,。 JUnit 是 Java 中开发单元测试的框架标准,世界上无数软件项目使用它。 支持测试代码的独立,是XP编程思想的体现。 解释:TDD 本节课内容简介 1.JUnit实例 2.JUnit核心简介 3.JUnit实例应用 4.JUnit最佳实践 9.1 JUnit 实例--源程序 public class Computer { private int a; private int b; public Computer (int x, int y) { a=x; b=y ; } public int add() { return a+b; } public int minus() { return a-b; } public int multiply() { return a*b; } public int divide() { if(b!=0) return a/b; else return 0; } } 9.1 JUnit实例--测试代码 import junit.framework.TestCase; public class TestComputer extends TestCase { pro

文档评论(0)

1亿VIP精品文档

相关文档