SimpleTest 与 PHPunit [英] SimpleTest vs PHPunit

查看:22
本文介绍了SimpleTest 与 PHPunit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人在这方面有经验的人可以阐明两者之间的显着区别(如果有的话)?

I was wondering if anyone that has experience in both this stuff can shed some light on the significant difference between the two if any?

每种方法的任何特定强度使其适用于任何特定情况?

Any specific strength of each that makes it suitable for any specific case?

推荐答案

这个问题已经过时了,但由于它仍在获得流量和答案,我虽然在这里再次说明我的观点,但我已经在其他一些(较新的) 问题.

This question is quite dated but as it is still getting traffic and answers I though I state my point here again even so I already did it on some other (newer) questions.

真的很困惑 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 (1&2)、Cake、Agavi,甚至 Symfony 也在 Symfony 2 for phpunit 中删除了他们自己的框架).
  • PHPUnit 集成在每个 PHP IDE(Eclipse、Netbeans、Zend Stuide、PHPStorm)中并且运行良好.
  • Simpletest 有一个适用于 PHP 5.1(又名旧版)的 Eclipse 扩展,仅此而已.
  • PHPUnit 可以很好地与每个持续集成服务器配合使用,因为它会输出所有用于代码覆盖率和测试报告的标准日志文件.
  • Simpletest 没有.虽然一开始这不是什么大问题,但一旦你停止只是测试",它就会让你大吃一惊.并开始开发软件(是的,该声明具有挑衅性:)不要太当真.
  • PHPUnit 得到积极维护、稳定且适用于每个代码库、每个场景以及您想要编写测试的每种方式.
  • (主观)PHPUnit 提供了更好的代码覆盖率报告比 Simpletest
  • 使用 PHPUnit,您还可以在 IDE 中获取这些报告(Netbeans, Eclipse, ...)
  • 还有一些关于 web 接口到 phpunit 的建议测试.
  • PHPUnit is the standard; most frameworks use it (like Zend Framework (1&2), 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. old) and nothing else.
  • PHPUnit works fine with every continuous integration server since it outputs all standard log files for code coverage and test reports.
  • Simpletest does not. While this is not a big problem to start with it will bite you big time once you stop "just testing" and start developing software (Yes that statement is provocative :) Don't take it too seriously).
  • PHPUnit is actively maintained, stable and works great for every codebase, every scenario and every way you want to write your tests.
  • (Subjective) PHPUnit provides much nicer code coverage reports than Simpletest
  • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, ...)
  • Also there are a couple of suggestings for a web interface to phpunit tests.

我还没有看到任何支持 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 3.7 开始,只需使用 PHAR 档案

As of PHPUnit 3.7 it's even easier to install it by just using the PHAR Archive

wget http://pear.phpunit.de/get/phpunit.phar
chmod +x phpunit-3.7.6.phar

或者对于 Windows,只需下载 phar 并运行:

or for windows just downloading the phar and running:

php phpunit-.phar

或使用支持的composer安装方式时喜欢

"require-dev": {
    "phpunit/phpunit": "3.7.*"
}

到你的 composer.json.

to your composer.json.

对于您想测试的所有内容,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 :)

视频:http://conference.phpnw.org.uk/phpnw11/schedule/sebastian-bergmann/

幻灯片:http://www.slideshare.net/sebastian_bergmann/the-php-testers-toolbox-osi-days-2011

它提到了诸如 Atoum 之类的东西,它自称:一种简单、现代且直观的单元测试PHP 框架!"

It mentions stuff like Atoum which calls its self: "A simple, modern and intuitive unit testing framework for PHP!"

我最初在 2011 年 1 月写了这个答案,当时我与任何 PHP 测试项目都没有关系.从那以后,我成为了 PHPUnit 的贡献者.

I've originally written this answer Jan. 2011 where I had no affiliation with any PHP Testing project. Since then I became a contributor to PHPUnit.

这篇关于SimpleTest 与 PHPunit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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