which unit-test framework for PHP: simpletest, phpunit or? [closed]

两盒软妹~` 提交于 2019-12-03 11:40:49

问题


I'm a big fan of simpletest because it's what I know. It has excellent support for mocking and web-testing.

But I'm always scared of stagnating so any compelling arguments to switch would be appreciated.


回答1:


I don't think either is going away anytime soon. Simpletest is maintained by a small, but involved group of people.

PHPUnit seems to have a bigger userbase, which may count as an argument for switching. I'm quite happy with Simpletest though.




回答2:


I haven't used SimpleTest myself, so I can't say much in a way of comparison. Just by observation though, the PHPUnit syntax seems much more verbose.

The PHPUnit Manual is a great source of documentation, and covers most areas of the framework. My only complaint about the manual is that some areas lack detail.

My main reason for using PHPUnit over SimpleTest is that it has great Phing integration.




回答3:


I just answered a similar question and added that there's phpt. phpt also integrates into PHPUnit.




回答4:


I would recommend behat (+mink) http://behat.org/

It's functional/integrational testing, but it covers much more code in much less time...

P.S. You can, actually, use it to write unit/tests, but it's a bit of overkill...




回答5:


I don't know if you'd want to switch per-se, but I like phpt for testing small libraries of code or getting tests out the door sooner rather than later, if there are none in an existing library that needs to be tested.

phpt won't scale as well as Simpletest, but again, the right tool for the right job. Take a look at this article for an in-depth discussion to get you ramped up.



来源:https://stackoverflow.com/questions/279564/which-unit-test-framework-for-php-simpletest-phpunit-or

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!