|
我发誓,从今天起,每行代码都要测试驱动!!(这个是2010年1月4日我个人的誓言,到今天以致以后都在坚决执行中。)
Today is a momentous day - first day of new year. Today I am going to start a new life. I am going to stop eating a greasy food, start attending a fitness club and today I am going to test programs I am writing. I can start right after the last line of a program is completed or, even better, I can write tests while I am coding. And maybe next time I will write tests before the coding, during the design stage. I have read a lot of literature on how to write the tests, I have the unit test framework in hand and an idea of new class. So let's get started.
今天是重要的一天 ? 新年的第一天。今天我要开始一种新的生活。我要停止吃充满油脂的食物,开始参加健身俱乐部, 并且今天我要开始测试写的程序。我会在程序最后一次结束后开始测试,更进一步,我可以在编码时编写测试。 下次我可以在编码前的设计阶段编写测试。 我已经阅读了大量关于如何编写测试的文献,我手头已经有了单元测试框架,并且已经有了新类的想法。 那么我们开始吧。
以上段落摘选自Boost手册。
如果你用过测试驱动开发,那么一定理解我所说的话,你会爱死它的,测试驱动就是一个最完美的软件开发指导者,帮助你写出好的正确的代码。
我用过几种不同的单元测试框架,但直到我遇到了Boost中的单元测试框架,我就没有再次更改过。他是专门为C++量身定做,没有任何额外的东西,简单而强大。
http://class.gd/node/33 |
|