Why should I be using testing frameworks in PHP?(为什么我应该在 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
这篇关于为什么我应该在 PHP 中使用测试框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我应该在 PHP 中使用测试框架?
基础教程推荐
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01