2008-04-02
JUnit In Action读书笔记(6)
关键字: observing results with testlistener(design patterns in actio
2.5 Observing results with TestListener(Design patterns in action: Observer)
利用此设计模式,在对象之间 ,我们可以定义一种"一对多"的依赖,那样当一个对象的state发生变化时,依赖于此的对象都得到通知并相应地自动更新.在JUnit里,把TestRunner作为一个TestListener注册到TestResult上的.(The TestRunner registering as a TestListener with the TestResult is an example of the Observer pattern.)
基于上面所说的设计模式,我们就可以很容易理解这段话了:"But does an object have to be a TestRunner to report on a test?Can more than one object report on a test at once?"JUnit框架中提供了TestListener,我们可以这个接口来access TestResult,并做出适合自己项目的测试报告.
you would only need to implement it if you were extending the JUnit framework, rather than just using it.
2.6 Working with TestCase
TestRunner(shipped with the framework) +TestSuite(provided automatically by JUnit,defaultly)+ TestCase = TestResult
这样为了得到TestResult,我们就可以只写TestCase了,通常一个TestCase包含有下面的两种主要的components: fixture和unit tests.
2.6.1 Managing resources with a fixture
利用此设计模式,在对象之间 ,我们可以定义一种"一对多"的依赖,那样当一个对象的state发生变化时,依赖于此的对象都得到通知并相应地自动更新.在JUnit里,把TestRunner作为一个TestListener注册到TestResult上的.(The TestRunner registering as a TestListener with the TestResult is an example of the Observer pattern.)
基于上面所说的设计模式,我们就可以很容易理解这段话了:"But does an object have to be a TestRunner to report on a test?Can more than one object report on a test at once?"JUnit框架中提供了TestListener,我们可以这个接口来access TestResult,并做出适合自己项目的测试报告.
you would only need to implement it if you were extending the JUnit framework, rather than just using it.
2.6 Working with TestCase
TestRunner(shipped with the framework) +TestSuite(provided automatically by JUnit,defaultly)+ TestCase = TestResult
这样为了得到TestResult,我们就可以只写TestCase了,通常一个TestCase包含有下面的两种主要的components: fixture和unit tests.
2.6.1 Managing resources with a fixture
发表评论
提醒: 该博客已发表在公共论坛,博客所有留言会成为论坛回贴,留言请注意遵守论坛发贴规则
- 浏览: 29413 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
链接
最新评论
-
对浏览器中的context menu ...
Drag dropper
-- by whqida -
Spring中的load-time weav ...
没啥,有些class不在spring的管理之中,通过 load-time wea ...
-- by ray_linn -
对浏览器中的context menu ...
别搞笑了, 这是浏览器的 Context Menu? 这只不过是响应了鼠标右击事 ...
-- by fcoffee -
IE tab在Firefox里开发时 ...
firebug只能用于ff, 并不能用于ff下的ietab, 原因显而易见.如果 ...
-- by fcoffee -
IE tab在Firefox里开发时 ...
还网告知 该如何操作呢 我还是要到ie下再调试啊
-- by jianfeng008cn






评论排行榜