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

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

问题描述

可能的重复:
简单测试对比 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 for phpunit 中删除了他们自己的框架).
  • PHPUnit 集成在每个 PHP IDE(Eclipse、Netbeans、Zend Stuide、PHPStorm)中,并且运行良好.
    • Simpletest 有一个适用于 PHP 5.1 的 Eclipse 扩展(也就是太老以至于它在 sourceforge 上),没有别的.
    • Simpletest 没有.虽然从一开始这不是什么大问题,但一旦您停止只是测试"并开始开发软件,它就会让您大吃一惊(是的,该声明具有挑衅性 :) 不要太当真).
    • Simpletest 无需维护、已过时且无法与 PHP 5.3(一年多前发布)配合使用
    • 使用 PHPUnit,您还可以在 IDE 中获取这些报告(Netbeans、Eclipse, ...)
    • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)

    我还没有看到任何支持 Simpletest 的论据.由于 PHPUnit 可通过 pear 获得,因此安装起来并不简单:

    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天全站免登陆