开发者

Why phper does not care test?

In Java or Ruby, there are ma开发者_StackOverflowny talks about test/TDD/BDD. and there are many tests in Java/Ruby projects.

But I notice that, there are less tests in PHP project, and It seems like PHPer does not like to write tests, I just want to know the reason. thanks


I've used several applications or libraries, in a variety of languages, that did not include unit tests. This is not something isolated to the PHP community.

In fact, PHP has several testing frameworks available. Developers may either choose not to use them for whatever reason, or may be unaware of them. After all, a lot of PHP developers are self-taught with no formal training in computer sciences.

Honestly, most PHP developers I know that do use testing frameworks and other lifecycle tools tend to have been in the field for a long time, or come from another background like Java.


IMO there are multiple contributing factors:

  • It's a pretty new concept for PHPers. I don't use it myself. Most applications are written without contractual API design, hence code preceedes tests (in practice).
  • The test frameworks (PHPUnit and SimpleTest) are not natural.
  • PHP runs in a different environment than Ruby/Java. Moreover application parts are split into include scripts, which have different semantics from packages; sometimes locations variate.
  • PHP isn't as object-oriented to the core as other languages. Most code is procedural / mixed or hybrid.

I would go so far and ask about the merits of Unit-Testing for PHPs runtime environment. Selenium might be a better choice. But personally I'm looking for a simpler approach: simple (non-unit) test framework, similar to .phpt, should evaluate output/headers/errors/results

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜