ITeye博客

JUnit -- 分析

orange5458 · 2011-12-11 18:08 · Open Framework · 开源软件 · Markdown

1.类结构图

 

 

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
  • TestSuite
  • TestCase

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。