Behavior Driven Development: As Human As Possible

I've been intrigued with everything I've read about "Behavior Driven Development" -- which is essentially a friendlier face on Test Driven Development.

For beginners like me I think the most obvious concept is that BDD = Test Driven Development Plus "natural sentence style test naming" as JP Boodhoo calls it.

For example, David Laribee gives examples where Tests and test fixtures are simply renamed according to a strict pattern, like this:

namespace Specs_for_TransactionElection
{
[TestFixture]
public class When_an_election_is_started : Spec
{
private ITransaction _stubTransaction;
private TransactionElection _election;

[Test]
public void The_result_should_be_in_progress()
{

Assert.AreEqual(_election.Result, TransactionElectionResult.InProgress);
}
}

The upshot of this is that the tests in the code runner read like a restricted-subset of plain English:

Behavior Driven Development example from Resharper

Some people, including David Laribee and Ryan LaNeve have said that the output of these stories could be improved to present a more human-readable form.

What i'd like to see is a better looking code runner.

The treeview control itself should present a "Friendlier" form of those names -- underscores could be converted into spaces. Larger fonts could be used for sub-headings. And the larger headings should be in lower contrast colour, so you can fade them out when you want to.

Here's a dodgy mockup:

Specifications for Transaction Election passed When votes are cast: passed A single no vote should rollback the transaction.passed A no vote will leave the election with a finished and voted no status. passed Unanimous yes votes will commit the underlying transaction.

The point here is that I'm not talking about improving the output of the unit test tool -- for example the 'Dox report generated by the MbUnit GUI runner' (as Ryan LaNeve has demonstrated)-- I'm talking about changing the runner itself so that it directly cleans up the names of the tests and fixtures for presentation.

It could even report on "Convention Breakers". (Squiggly red underline perhaps).

(side note: matt calla provides a macro for doing the exact opposite of this.)

(Other side note: is this similar to Donald Knuth's idea of literate programming?)

 

My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.