PHP中TDD和/或BDD的状态是什么? [英] What's the state of TDD and/or BDD in PHP?

查看:90
本文介绍了PHP中TDD和/或BDD的状态是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP世界中,测试的普及程度,支持程度和开发程度如何?与Java相提并论?上面有Ruby/Rails吗?我搜索了一下,发现存在测试框架,但是我想知道它们是否被广泛使用.

How widespread, supported, developed is testing in the PHP world? On par with Java? Up there with Ruby/Rails? I Googled and found that testing frameworks exist but I'm wondering if they're widely used.

主要的PHP IDE是否具有像Eclipse的Java工具或NetBeans的Ruby/Rails工具一样的内置测试运行程序?是否像Rails一样将测试内置到PHP的MVC框架中?

Do the major PHP IDE's have built-in test runners the way Eclipse's Java tools do or NetBeans's Ruby/Rails tools do? Is testing built into PHP's MVC frameworks as with Rails?

我之所以这样问,是因为我工作的一个团队想要雇用某人为他们开发PHP应用程序.我担心质量和维护问题,可能会要求我提供支持.

I ask because a group where I work wants to hire someone to develop a PHP app for them. I'm concerned about quality and maintenance as I might be called on to support this thing.

推荐答案

至少有两个成熟的,独立的JUnit风格的测试套件,名为 PHPUnit SimpleTest .

There are at least two mature, stand-alone, JUnit style test suites available, named PHPUnit and SimpleTest, respectively.

就MVC框架而言,Symfony拥有自己的名为石灰,代码点火器具有 unit_test 库和 CakePHP 依赖于上述SimpleTest.

As far the MVC Frameworks go, Symfony has its own testing framework named lime, Code Igniter has a unit_test library and CakePHP relies on the aforementioned SimpleTest.

我知道Zend Studio内置了对PHPUnit测试的支持,并且PHPUnit和SimpleTest都具有命令行运行程序,因此可以集成到任何工作流程中.

I know that Zend Studio has built in support for PHPUnit tests, and both PHPUnit and SimpleTest have command-line runners so integration into any workflow is possible.

如果开发人员想利用这些工具,那么这些工具就在PHP世界中存在,而智能商店确实可以利用它们.

The tools are there in the PHP world if a developer wants to take advantage of them, and smart shops do take advantage of them.

注意事项是您对PHP投诉课程的满意程度.有两个PHP社区; PHP作为构建软件的平台,PHP作为与Web服务器,Web浏览器和数据库进行交互以在Web上产生类似应用程序的事物的方式.它不是一个黑白的东西,而是一个连续体;在软件开发人员侧的更多测试中,与任何其他平台一样,都支持并使用单元测试和TDD.在将一堆我不理解但仍能得到成果的人凑在一起"中,这是闻所未闻的.

The caveats are your par for the course PHP complaints. There are two PHP communities; PHP as a platform for building software, and PHP as a way to interact with a web server, web browser, and database to produce application-like things on the web. It's less a black and white thing and more a continuum; Among those more on the software developer side unit testing and TDD is supported and used as much as it is on any other platform. Among the "cobble together a bunch of stuff I don't understand but still get results people", it's unheard of.

周围有很多非框架/自定义框架的遗留PHP代码,很难获得有用的测试工具. PHP还很容易将其自身提供给依赖于运行浏览器环境的模式.除了我自己的观察之外,我没有任何证据可以证明这一点,但是许多关心测试的PHP商店最终都依靠验收测试(即Selenium)来代替实际的单元测试,测试优先等.开发.

There's a lot of non-framework/custom-framework legacy PHP code around that's difficult to get a useful test harness around. PHP also lends itself easily to patterns that rely on the existence of a browser environment to run. I don't have any evidence to back this up other than my own observations, but a lot of PHP shops that care about testing end up relying on acceptance testing (i.e. Selenium) as a substitute for actual Unit Testing, test-first, etc. development.

在您的特定情况下,与小组要雇用的开发人员面谈.

In your specific situation, interview the hell out of the developer your group is going to hire.

  1. 问他们使用什么单元测试框架

  1. Ask them what unit testing framework they use

请他们概括地描述他们开发新功能及其支持测试的真实示例

Ask them to describe, in general terms, a real world example of a time they developed a new feature and its supporting tests

请他们概括地描述测试失败的时间以及解决问题的方法的真实示例

Ask them to describe, in general terms, a real world example of a time their tests failed and what they did to resolve the situation

您对他们将要描述的特定情况不那么感兴趣,而对他们一般而言讨论自己的代码测试知识的舒适性更感兴趣.

You're less interested in the specific situation they're going to describe and more interested in how comfortable they are discussing their knowledge of code testing in general.

这篇关于PHP中TDD和/或BDD的状态是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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