Alex Rivera | Logout

What's the state of TDD and/or BDD in PHP?

Asked 2009-02-10T00:53:16.367
30

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.

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?

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.

Edit
Report

1 Answer

5

I have had an amazing experience with Behat / Mink http://behat.org

I agree with others php as a unit testing platform is not a fun or experience BDD is the best way to go if you are using any php framework

Wrapping my head around composer as a repo build tool was the biggest stumbling block but we were able to use Behat Mink Selenium Webdriver standalone server jar as an amazing design and regression testing tool. We used to run our regression suite against our CakePHP application on a Jenkins server but it proved to be not so very "fail fast" enough

Now our workflow goes like this: Create story in gherkin refine story write feature and stub out any new step defs begin coding php solution to test Then at the end we have a working feature or bug fix with a bdd test covering it

We setup an Ubuntu VM with a working Behat setup and copied it to every workstation. We baked it into our process. We just pull down changes run tests then begin coding new stuff.

We wrote a shell script to automatically run mysql dumps and load them before each feature which has made refactoring code a breeze.

The Mink WebAssert class gives you all the assertions you need to validate behavior The regular session / CommonContext classes are great for using css or xpath.

I have used Capybara / WebDriver with Java and Rails projects before and found the setup overhead / learning curve is too high compared to Behat.

answered 2013-01-08T01:20:37.537

Your Answer