2007/05 8
经过一番折腾,终于把simpletest整合到了开发环境中。接下来,实验一下测试驱动开发。
很久以前就想学习这一些测试了,但是始终没有理解测试驱动的含义及其在XP中的含义。希望本次实验级可以获得对测试驱动的进一步认识。
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-05-08 17:45
2007/01 6
淘汰wordpress,使用上了serendipity了。
测试一次
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-01-06 18:11
2006/11 30
日期,2006-11-28。
详细信息地址:http://sourceforge.net/project/showfiles.php?group_id=76550

上一次更新版本和时间是simpletest_1.0(2005-05-30),距离现在近半个月,相应eclipse插件也版本号也增加了0.01。更新时间之长,改进之少,版本进度之慢我无语。不过好东西我还是去会用的。
所以,不管怎么样,我都感谢simple test的开发人员。
Defined tags for this entry: ,

Posted by rollenc

Not modified
2006/11 26
最近几天一直在研究SugarOS,主要在学习其中设计模式和编程风格等。
其中使用了以下的工具和组件等:
  • Eclipse & PHPEclipse。 我对比了一下DreamWeaver(DW),Zend Studio(ZS),Eclipse & PHPEclipse(E&PE)三种开发工具,厌倦DW的全站搜索功能,各个文件间的关联很松散。ZS强在逐步调试,但好像我并不需要,从大局把握整个系统才是最重要的。另外就是ZS的速度让我的256机子疯掉了。E&PE是最佳的选择,整个系统完整的融合在一起,不需要ctrl+F就可以在相关联的函数,类中跳转。
  • Simple Test 试着以测试的方式去思考。不过我更希望是测试驱动开发。这样更有趣些。唯一的遗憾是Simple Test for eclipse的插件没有安装好,各个文件间的包含关系处理不正常,看了一下readme文件,有这么一句:
    Future Features These are features that should eventually make it into this plugin * Allow different "include" file on each runner (override the "master" include) * Handle fatal errors better
    所以,只能等待下一个版本出来了。现在先在WEBPAGE里面用Simple Test吧。
  • 重构 我没有准备去重构这个系统,几天的代码阅读,也没有问到“代码臭味”,但是我会在代码中去理解,重构的目标:设计模式。
  • 设计模式 这是我一眼看中这个系统并把它作为我的学习对象的原因。先在再看DB部分,对整个的构建模式有了很大的体会。不过,完全理解这个系统的代码对现在的我来说还是有困难的,在复杂的工厂模式中还是会迷路,找不到系统运行的流向。





Defined tags for this entry: , , , ,

Posted by rollenc

Not modified
2006/10 29
Test First Guidelines
Sean Shubin
01/25/2002
Sean Shubin has begun using Test-First development. He wanted to share these ideas and guidelines with us.

Contents:

This document is my attempt to filter out guidelines about Test First Design from the XP series of books. Thanks to Denise Phillips and Ron Jeffries for their input. It is not my intent to justify Test First Design, I just want summarize what martin Fowler's Refactoring and the XP texts have to say on the subject. If you see anything that you think contradicts these sources, please e-mail me with the book and page number. I am still working on samples for each of these guidelines. If you find any of them completely confusing, send me an e-mail to let me know which ones I need to work on. Send e-mail to Sean Shubin, (remove the "nospam" portion of the e-mail address).

The tests should drive you to write the code, the reason you write code is to get a test to succeed, and you should only write the minimal code to do so. Note that test-first-design is more than just unit testing. Unit testing by itself does not change the design of the code. In addition to documenting how code should be used, test-first-design helps you keep the design simple right from the start, and keeps the design easy to change.

As project complexity grows, you may notice that writing automated tests gets harder to do. This is your early warning system of overcomplicated design. Simplify the design until tests become easy to write again, and maintain this simplicity over the course of the project.
Guidelines for test first design:

* The name of the test should describe the requirement of the code
* There should be at least one test for each requirement of the code. Each possible path through of the code is a different requirement
* Only write the simplest possible code to get the test to pass, if you know this code to be incomplete, write another test that demonstrates what else the code needs to do
* A test should be similar to sample code, in that it should be clear to someone unfamiliar with the code as to how the code is intended to be used
* If a test seems too large, see if you can break it down into smaller tests
* If you seem to be writing a lot of code for one little test, see if there are other related tests you could write first, that would not require as much code
* Test the goal of the code, not the implementation
* One test/code/simplify cycle at a time. Do not write a bunch of tests, and try to get them working all at once
* Keep writing tests that could show if your code is broken, until you run out of things that could possibly break
* When choosing an implementation, be sure to choose the simplest implementation that could possibly work
* If you are unsure about a piece of code, add a test you think might break it
* A test is one specific case, for which there is a known answer
* If all of the tests succeed, but the program doesn't work, add a test
* Tests should be as small as possible, before testing a requirement that depends on multiple things working, write a test for each thing it depends
* Tests should not take longer than a day to get working, typical test/code/simplify cycles take around 10 minutes
* Don't test every single combination of inputs. Do test enough combinations of inputs to give you confidence that the any code that passes the test suite will work with every single combination of inputs
* Do not write a single line of code that doesn't help a failing test succeed. (Clarification for GUI's, some aspects of GUI's are impossible to test automatically, so it will have to be an acceptance test that drives you two write some GUI code. Use automated testing whenever possible)
* Do not fix a bug until you have written a test that demonstrates the bug

What is the simplest code? (Paraphrased from the "Extreme Programming" series of books)

* All of the tests run
* There is no duplicate code (any given code segment or structural pattern should appear "once and only once")
* Clarity. The code and tests communicate the intent as clearly as possible
* The code is minimal (no classes or methods unnecessary to get the tests to pass)

The Test-Code-Simplify cycle (Quoted verbatim from "Extreme Programming Applied", p159)

* Write a single test
* Compile it. It shouldn't compile, because you haven't written the implementation code it calls
* Implement just enough code to get the test to compile
* Run the test and see it fail
* Implement just enough code to get the test to pass
* Run the test and see it pass
* Refactor for clarity and "once and only once"
* Repeat

Online Examples of Test First Design:

Roman numeral converter example

http://www.differentpla.net/~roger/devel/xp/test_first/

Sample application that calculates bowling score

http://www.objectmentor.com/publications/xpepisode.htm

Books:

"Refactoring" and "Design Patterns" tell you how to maintain a simple design.

The "Extreme Programming" series explains test-first design in detail, and was the primary resource I used to put together this set of guidelines.

来源:http://xprogramming.com/xpmag/testFirstGuidelines.htm
最近感觉想翻译的东西太多了,有一些就纯粹转载了。有时间再翻译。
Defined tags for this entry: , , ,

Posted by rollenc

Not modified
2006/10 29
以前在学习《php设计模式》时,学习了一点点simple Test的知识,停留在单元测试的学习就停了。也写过一些测试代码,但觉得很烦,对于测试用例也没有研究,还有不知道如何来测试PHP的输出,如一些ECHO语句等。所以,没有坚持下来,一直简单的以var_dump来调试。
现在要重新拣拾起来,重新开始学,希望能够理解好测试驱动的开发思想和编写好的测试用例等。
参考网址:
http://www.lastcraft.com/simple_test.php
http://simpletest.org/
Defined tags for this entry: , , ,

Posted by rollenc

Not modified
2006/03 7
不好意思,打扰一下,如果trackback成功到了您的网站,你可以直接删除,这个页面没有任何可以内容。
测试一
测试二
测试3
测试4
测试5
测试6
测试7
测试8
测试9
测试十
Defined tags for this entry:

Posted by rollenc

Last modified on 2007-03-11 13:44