Behaviour-driven development (BDD) frameworks

Behaviour-driven development (BDD) is an agile development technique, and is a subtle reworking of test-driven development (TDD). Learning about it finally made the concept of TDD "click" for me. People often use the term "test-infected" or "bitten by the testing bug" to describe the feeling that comes from appreciating the power of BDD/TDD, and I'd certainly say that I'm a "sufferer".

The purpose of this post is to compile a list of BDD and TDD frameworks that I've come across, covering several different programming languages. I hope to write up some simple examples of using a few of the frameworks at a later date.

I've heard it said that if you're doing TDD right, then you're already practising BDD, and this made a lot of sense once I understood the reasoning behind BDD. I'll leave further explanation of the differences to the experts.

Without further ado, here's the list:

PHP

  • PHPSpec, a fledgling BDD framework for PHP5.2+. The manual is well-organised, and gives a good overview of writing BDD specifications. Its development seems to have stalled at present, unfortunately.
  • Marcus Baker's SimpleTest (TDD). This is the framework for PHP that I have most experience with, and it seems to be the most popular at present. It has a plethora of features, including strong support for mock objects. The manual gives a good overview of the major features.
  • PHPUnit (TDD). I have no experience with this one, but it's one of the most established PHP testing frameworks, and it still seems to be popular. Like SimpleTest, it has plenty of features, and the manual appears to be very thorough.

JavaScript

C

  • Cgreen (TDD), which is by the same author as SimpleTest. It has a five-minute example of test-driven development with the framework. It was heavily influenced by...
  • The Check framework (TDD), which has a fairly friendly manual. I know even less about this one than Cgreen, sadly.

Both of these projects seem to have been dormant since 2006. The Check manual lists a number of similar projects, but I've not even glanced at those, as I'm still a C newbie.

Python

  • PySpec is the only BDD Python framework I could find, and while it appears to have a good amount of features, development is slow. It has a decent one-page usage guide, a reasonable tutorial, and a code reference with examples.
  • Doctests. I absolutely love these little things. The Python manual section on them is pretty comprehensive. They have a very low barrier to entry, and virtually no learning curve. The advanced features of independent testing frameworks aren't present, however.
  • nose (TDD), as I understand it, wraps Python's included unittest module to provide an interface similar to py.test, which I have no experience with. nose has a mini-manual on its homepage, and a wiki on its Google Code project site.

Ruby

  • RSpec. I don't really do Ruby (yet), but judging by what I've seen of RSpec, I seriously doubt whether anything else is even worth considering. The Rubyists really seem to get BDD.

SitePoint giveaway

SitePoint are having another book-giveaway, and this time it's The Art & Science of CSS, which I've not read yet -- so this is a good excuse!

The giveaway is valid for 14 days, so grab it while you can if you're interested.

LOLst In Space

I have (hopefully) something more substantial and technology-oriented coming up, but in the meantime, I feel geekily obliged to draw your attention to the fantabulous Bas Astronomy Blog by Phil Plait, Ph.D., and in particular, this recent post regarding black LOLs.

The nerdy jokes in the comments had me on the floor in tears. "Epic win", as I believe the kiddies say these days. ;)

The Python-learning is coming along swimmingly (and at a surprising rate), so that should make more of an appearance in the near future.

OMG ponies!

A certain someone has been prodding me to start blogging again, and my excuses have finally run out, so here's a random post to get started again with.

I've just cleared out four months' worth of caught spam (hooray for Habari's spam catcher!), and sorted through all the unapproved (mostly spam) comments. This "spamment" in particular made me smile, if only for its sheer cheek:

Please, do not delete the given message. Money obtained from spam will go to the help hungry to children ugandn

To all the hungry to children ugandn out there: I'm sorry, my finger slipped.

In other news, I've recently started to teach myself Python, and I've been amazed at how well it "fits my brain", as someone else once said about a programming language. Python is incredibly easy to pick up (at least if you already know the basics of programming), and I've found myself becoming quite at home with its idioms -- unlike when I tried Ruby, sadly. I'll have to give Ruby another try one of these years. Its class and inheritance syntax makes more immediate sense to me, that's for sure.

I've also upgraded Habari now, which was pleasantly painless to do. I'll make my own theme for it one of these days, when I've got something better to do.

STOP PRESS: Microsoft to make IE8 standards-compliant by default!

I'm stunned. This is not what I expected. Some sort of concession, maybe, but nothing like this. Way to go, Microsoft!*

From the IEBlog post:

We’ve decided that IE8 will, by default, interpret web content in the most standards compliant way it can.

I personally consider this fantastic news. I was broadly opposed to the version targeting idea as presented, i.e. that it would be an "opt-in" system, but had largely resigned myself to either ignoring it, or suffering it if I deemed the new CSS/JavaScript shinies in IE8 worth the effort.

Any site needing IE8 to render in IE7 mode (for whatever reason) need only apply a one-line fix: the meta version targeting method originally proposed to work the other way around (or the HTTP header equivalent).

In summary, this is the good news, as I see it:

  • Developers need do nothing beyond using current standards to get the best standards-compliance from IE8.
  • The change should encourage developers to adhere more strictly to existing standards, particularly if doing so enables more advanced CSS and JavaScript capabilities in IE8.

This should also mean that IE8 will automatically pass the Acid2 test, rather than requiring a nudge to do so. From the Microsoft press release:

IE8 has been significantly enhanced, and was designed with great support for current Internet standards. This is evidenced by the fact that even in its first beta, IE8 correctly renders the popular test known as 'Acid2', which was created by the Web community to promote real-world interoperability [...] Our initial plan had been to use IE7-compatible behavior as the default setting for IE8, to minimize potential impact on the world's existing Web sites. We have now decided to make our most current standards-based mode the default in IE8.

And this is the potentially bad:

  • Anyone requiring, for some reason, IE8 to behave as IE7 will need to add the meta switch or the HTTP header to their code.
  • More inconvenience in the short term for anyone supporting legacy documents.

I'm very impressed by Microsoft's move, and hope that it doesn't somehow get overruled or watered-down before IE8 is released.

(*I can honestly say that I never thought I'd write that - "never say 'never'", I guess!)

 1 2 3 Next →

About

I'm a 22-year-old Web developer with a passion for standards-adherence, and a strong belief in quality over quantity and using the right tool for the job.

User