Skip to content
Advertisement

Behat over Cucumber in PHP

Don’t get me wrong. I think both projects are fantastic.

But as both php and ruby developer I wonder if there are there any compelling reasons, besides possible language barrier, why would one choose Behat over Cucumber (with cuke4php) for BDD even when working with php or some php framework.

Advertisement

Answer

I’m a Behat developer.

Why I’ve developed Behat instead of Cucumber customization:

  1. Speed. There’s no simple way to bootstrap/run PHP from Ruby code. This means that you need to implement wires/proxies and other things, which makes your tests insanely slower. And slower tests is not a test, it’s just code that eats your customer’s money.
  2. Extensibility. There are very few PHP developers that really know Ruby. It’s a hard to use tool, that many don’t understand! All examples written for Cucumber are Ruby code and you even can’t look at Cucumber sources, because, let’s say, you don’t know Ruby. It’s like buying a submarine when you just need a taxi.

In terms of features, Behat and Cucumber are almost the same (I’ve worked hard to achieve this). But in terms of speed/extensibility/logic from a PHP developer’s perspective – Behat is better, because it’s a fast and clean native PHP tool. Behat is not a Cucumber port, as you might think by first, it’s built entirely from the ground on PHP 5.3. Behat is trying to simulate Cucumber with its input reading (features) and output formatting (formatters), but it’s not a Cucumber port (there are no Ruby syntax constructions in PHP).

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement