2004年08月27日

Be serious to each bug, or you will see them again and again.
Three Questions About Each Bug You Find

2004年05月13日

If you want to use CppUnit on your GUI application, this is the question that must be answered.

Unfortunately, it’s also the most difficult one to answer. Yesterday, I post a book link which have some contents on TDD on GUI application.

Today, when I browse the forum of CppUnit home, I found below thread in which one of the author say what I want to say about this topic. That is “MAKE YOUR CLASSES INDEPENDANT AND MAKE YOUR UI CLASSES AS THIN AS POSSIBLE. “. It’s interesting that I’ve write similar words months before in the internal team mailing list on unit test(in which I also use “as thin as possible”).

HowTo :CPPUNIT to unittest MFC/UI application

对于那些急于看到运行结果的人来说,官方的CPPUNIT document中带的“CPPUNIT Cookbook”肯定会让你觉得比较挫折,不幸的是,我就是其中一位。

还好,借助google,我找到了如下文章

便利的开发工具CppUnit 快速使用指南

里面的例子非常简单,而且按照指导可以方便在Linux环境下编译通过,而这,正是我所需要的。

还有两篇同等目的的文档,可供参考

一篇是MFC下的,我没有验证,但是细节都有

CppUnit 使用說明

还有一篇有更多的例子和说明,解开之后进入FirstCppUnitTest目录,将Makefile稍作修改即可编译通过

HowTo for CppUnit TestFramework

我相信看过这三篇中的任意一篇后,再回头看CPPUnit的官方文档回亲切的多。

BTW,为了解决问题,我到CPP Unit的主页的Forum去看了一下,发现有人和我有同样的入门困惑。CPP Unit自带的入门文当中的例子不是可以简单编译通过的例子,而在其example目录下的例子我没有发现更详细的解释,更何况,这个例子过于庞大了!

这应该说是一种遗憾,尤其对于那些想尝试一下CPP Unit工具的入门者

This is what I concern most recently. I recall that I read a article on “Programmer” in which the author try to refactor a existing “device driver” program. However, I think this is not a in-depth article which fail to show the practical experience on an realworld existing project.


Today, in the testdriven.com, I read an FAQ item on this topic – Can we use it with existing software projects? . The first word is “Certainly” while the second work is “However”. So you must know what result you can expect from this FAQ item.


However, I think using TDD & refactoring method on an existing project is nothing but the biggest gap for these theory to be put into real-world practice and widely accepted. If I can use TDD to reconstruct my existing project, I surely will stick to TDD in next new project.


So, Just try. If you never try it, you’ll never get the answer.

2004年05月12日

Test Driven Development: A Practical Guide


有一个书评说到点子上,总之,此书值得一看(影印版已出!)


4 out of 5 stars TDD with some UI examples!, December 21, 2003





Reviewer: Lars Bergstrom (see more about me) from Kirkland, WA
The single best thing that distinguishes this book from the other TDD books on the market is its effort to produce a believable application during the course of using TDD. It even showed a way of unit testing GUI applications, which is easily the hardest thing in-practice about TDD.

On the bad side, some nicer abstractions around the UI and any patters he’d come up with to make UI TDD better would’ve been a great takeaway. Also, he said that he’d be using Smalltalk-style names because that was what it was familiar with, which is totally bogus. The book should be written for the reader, not for the writer — if he was that attached to and unwilling to give up Smalltalk, then why write it using Java?