为什么我应该使用 PHP 测试框架?
最近,我听到很多人争论如何将 PHPunit 和 SimpleTest 等 PHP 测试功能与他们选择的 IDE(对我来说是 Eclipse)一起使用。在谷歌搜索该主题后,我仍然很难理解使用这些测试框架来加速开发的利弊。
如果有人可以从更基本的层面为我解释这一点,我将非常感激。我使用 PHP5 来发送通知。
多谢!
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.
If anyone could explain this for me in a more basic level, I would really appreciate it. I am using PHP5 for the notice.
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是单元测试的忠实粉丝:我并不是说它们没有用,它们在某些情况下可能非常有用。
问题是有些人倾向于高估他们可以通过单元测试做什么。
只需记住两件事:
1) 单元测试不能替代 beta 测试。即使其背后的代码有效,坏接口仍然是坏接口。 (例如:如果一个按钮不可点击,那么它所附加的功能是否有效并不重要)
2)单元测试需要时间来编写。如果您单独或在一个小团队中开发一个小项目,也许您可以利用这段时间来改进您的代码。
看看这个(请持保留态度地阅读,很明显作者的写作方式是具有挑衅性的):
http://www.wilshipley。 com/blog/2005/09/unit-testing-is-teh-suck-urr.html
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.
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.
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