读书人

JUnit - 分析

发布时间: 2012-07-20 10:38:30 作者: rapoo

JUnit -- 分析

1.类结构图

?


JUnit - 分析

?

Assert : 大量的assert开头的结果和预期判定方法,如果判定失败则抛出AssertionFailedError

TestCase : 一个实例对应测试用例,对应fName名称对应的方法

TestResult : 保存测试结果,

fFailures --> AssertionFailedError集合

fErrors -->?除AssertionFailedError,ThreadDeath之外的Throwable集合

fListeners --> TestListener集合

TestSuite :?一组TestCase实例的集合,

可以在构造时传入一个Class对象,自动为该类中每一个以test开头的无参void返回类型方法创建一个TestCase实例

TestRunner : 客户对象调用的起点,负责对整个测试流程的跟踪。能够显示返回的测试结果,并且报告测试的进度。

不同的环境中有不同的TestRunner,如junit.textui.TestRunner,junit.awtui.TestRunner ......
?

2.运行时序图

TestRunner
JUnit - 分析
?TestSuite
JUnit - 分析
?TestCase
JUnit - 分析
?

读书人网 >开源软件

热点推荐