1 min read

Behat for Behaviour-driven development, Konstantin Kudryashov

I’m in Leeds for the Drupal Camp Yorkshire conference, blogging and tweeting about the event.  

By the time we’d started to get into day 2 at Drupal Camp Yorkshire, I’d started to notice a trend of UX taking a forefront in development. This continued with Konstantin Kudryashov’s talk about using Behat.

Behat is a BBD framework that he created to encourage business smart tests rather than features. Like Kubair Shirazee the day before, Kudryashov encouraged fighting against features being added without thought to the case. He’d had an example where a client had wanted registrations for a site, when the real issue was customers being able to check the status of the purchases. (For the record, UXers are wary about registrations in e-commerce and encourage guest checkouts wherever possible).

Behat instead tests scenarios (something familiar to UXers) in plain English e.g.

For The login page
      When I am not logged in to the site
      And I don't have an account
        Then I should be able to register

From what I can gather (this started to get into the edge of my Drupal dev skills) Behat takes the plain English and makes the code for a feature which can then be tested for pass and fail.

Kudryashov mentioned that this doesn’t replace good old fashioned unit testing: Behat tests the functionality of business goals, unit testing would test code quality, security etc etc. From my perspective, usability testing also complements this: it’s good to know that visitors can register (it’s never fun when a site completely fails) and then tests with users (or even a UX expert review) can ensure that they can find it and that it doesn’t have excessive steps etc.

One extra element from UX can help with a question that an audience member raised. He was concerned about conflicting interested e.g. usability vs stability in a scenario. Kudryashov rightly suggested that this comes down to communicating with the client to decide priorities, but the UX practice of identifying and clarifying personas can help illuminate these potential conflicts and resolve them.

The full video of his talk is available on Youtube. A similar talk he did a while back also has a nice writeup by the Curve guys.

[youtube https://www.youtube.com/watch?v=E8k2Sr76MAI&w=700 ]