为什么我应该在 PHP 中使用测试框架?
我最近听到很多人争论将 PHPunit 和 SimpleTest 等 PHP 测试功能与他们选择的 IDE(对我来说是 Eclipse)一起使用.在谷歌上搜索了这个主题之后,我仍然很难理解使用这些测试框架来加速开发的利弊.
I have recently heard a lot of people argue about using PHP testing features like PHPunit and SimpleTest together with their IDE of choice (Eclipse for me). After googling the subject, I have still a hard time understanding the pros and cons of using these testing frameworks to speed up development.
如果有人能在更基本的层面上为我解释这一点,我将不胜感激.我正在使用 PHP5 作为通知.
If anyone could explain this for me in a more basic level, I would really appreciate it. I am using PHP5 for the notice.
非常感谢!
推荐答案
我不是单元测试的忠实拥护者:我并不是说它们没用,它们在某些情况下可能非常有用.
I'm not a big fan of unit testing: I'm not saying they're useless, they can be very useful - in certain situations.
问题是有些人倾向于高估他们可以通过单元测试做什么.
The thing is that some people tend to overestimate what they can do with unit test.
只要记住两件事:1) 单元测试不能替代 beta 测试.一个糟糕的接口仍然是一个糟糕的接口,即使它背后的代码有效.(例如:如果一个按钮是不可点击的,那么它所附加的功能是否有效并不重要)2)单元测试需要时间来编写.如果您正在单独或在一个小团队中开发一个小项目,也许您可以利用这段时间来改进您的代码.
Just remember two things: 1) Unit test CANNOT substitute beta testing. A bad interface remains a bad interface even if the code behind it works. (e.g.: if a button is unclickable it doesn't really matter whether the function to which it is attached works or not) 2) Unit test require time to be written. If you're developing a small project alone or in a small team maybe you can use that time to improve your code.
然后看看这个(请用少许盐阅读它,很明显作者在他写东西的方式上是在挑衅):http://www.wilshipley.com/blog/2005/09/unit-testing-is-teh-suck-urr.html
And have a look at this (please read it with a pinch of salt, it is obvious that the author is being provocative in the way he writes things): http://www.wilshipley.com/blog/2005/09/unit-testing-is-teh-suck-urr.html
相关文章