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:
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 When votes are cast: A single no vote should rollback the transaction. A no vote will leave the election with a finished and voted no status. 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?)
Next → ← PreviousMy book "Choose Your First Product" is available now.
It gives you 4 easy steps to find and validate a humble product idea.