在PHP中开始什么单元测试 [英] What unit testing in PHP to start

查看:172
本文介绍了在PHP中开始什么单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
简单测试与PHPunit

Possible Duplicate:
Simple test vs PHPunit

我对软件开发的良好实践是陌生的.我需要与女巫测试单元框架一起使用.我已经看到有些人使用PHPUnit,而另一些人使用SimpleTest.我应该为初学者选择什么套餐?

I'm new to good practices on software development. I need to know with witch testing unit framework should I use. I have see that some people use PHPUnit and others use SimpleTest. What package should I choose for a beginner?

最好的问候

推荐答案

我真的真的感到困惑,因为Simpletest仍然被认为是phpunit的替代品.也许我只是被误导了,但据我所知:

I'm really really baffled that Simpletest still is considered an alternative to phpunit. Maybe i'm just misinformed but as far as I've seen:

  • PHPUnit是标准;大多数框架都使用它(例如Zend Framework,Cake,Agavi,甚至Symfony也在Symfony 2中为phpunit删除了自己的Framework).
  • PHPUnit集成在每个PHP IDE(Eclipse,Netbeans,Zend Stuide,PHPStorm)中,并且运行良好.
    • Simpletest具有针对PHP 5.1的eclipse扩展名(又名太老了,它在sourceforge上).
    • PHPUnit is the standard; most frameworks use it (like Zend Framework, Cake, Agavi, even Symfony is dropping their own Framework in Symfony 2 for phpunit).
    • PHPUnit is integrated in every PHP IDE (Eclipse, Netbeans, Zend Stuide, PHPStorm) and works nicely.
      • Simpletest has an eclipse extension for PHP 5.1 (a.k.a. so old that it's on sourceforge) and nothing else.
      • 最简单的不是.尽管这不是一个大问题,但是一旦您停止仅仅测试"并开始开发软件,它就会占用您大量的时间(是的,这很具有争议性:)不要太在意它.)
      • 简单测试无法维护,已过时并且不能与PHP 5.3(一年多以前发布)一起很好地工作
      • 使用PHPUnit,您还可以在IDE中获得这些报告( Netbeans ,Eclipse ,...)
      • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)

      我还没有看到支持Simpletest的任何论点.安装起来并不容易,因为可以通过pear获得PHPUnit:

      I've yet to see any argument in favor of Simpletest. It's not even simpler to install since PHPUnit is available via pear:

      pear channel-discover pear.phpunit.de
      pear install phpunit/PHPUnit
      

      和首次测试"看起来几乎一样.

      and the "first test" looks pretty much the same.

      对于要测试PHPUnit的所有内容,都有解决方案,您几乎可以在任何地方找到帮助(例如,freenode上的#phpunit irc频道,几乎每个php开发人员;))

      For everything you want to test PHPUnit will have a solution and you will be able to find help pretty much anywhere (SO, #phpunit irc channel on freenode, pretty much every php developer ;) )

      如果我说错了或忘记了一些,请纠正我:)

      Please correct me if i've stated something wrong or forgot something :)

      这篇关于在PHP中开始什么单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆