Behaviour Driven Testing


The difference between Behavior-Driven Development and testing:

This is a BDD scenario (from Dan North, a man I respect and admire):
+Scenario 1: Account is in credit+

Given the account is in credit

And the card is valid

And the dispenser contains cash

When the customer requests cash

Then ensure the account is debited

And ensure cash is dispensed

And ensure the card is returned
This is that BDD scenario turned into testing:

+Scenario 1: Account is in credit+

Given the account is in credit

And the card is valid

And the dispenser contains cash

When the customer requests cash

Then check that the account is debited

And check that cash is dispensed

And check that the card is returned

And check that nothing happens that shouldn’t happen and everything else happens that should happen for all variations of this scenario and all possible states of the ATM and all possible states of the customer’s account and all possible states of the rest of the database and all possible states of the system as a whole, and anything happening in the cloud that should not matter but might matter.

Do I need to spell it out for you more explicitly? This check is impossible to perform. To get close to it, though, we need human testers. Their sapience turns this impossible check into plausible testing. Testing is a quest within a vast, complex, changing space. We seek bugs. It is not the process of  demonstrating that the product CAN work, but exploring if it WILL.

I think Dan understands this. I sometimes worry about other people who promote tools like Cucumber or jBehave.
I’m not opposed to such tools (although I continue to suspect that Cucumber is an elaborate ploy to spend a lot of time on things that don’t matter at all) but in the face of them we must keep a clear head about what testing is.

Source: www.satisfice.com


I read this article from James Bach's site 6 months back. Why i am posting this here now? Because i am currently managing projects in my unit that use Cucumber, RoR(Ruby on Rails), JRuby as part of the BDD approach. :-))

1 opinions:

Abi Abiah said...

The company I am working with owns huge software testing department and have sound experience for working with small to big companies. Company also includes software testing services for Microsoft.

Even I am not familiar with the term you have focused to write the article, but I am sure if I share this article with my colleagues, it will work for sure.