I am trying to wrap my mind around this new acronym I found this morning. BDD(Behavior Driven Development).

I've been reading various articles all day online and they all seem to suggest TDD and BDD as different things that compliment each other. From my readings I thought I understood BDD to be testing at a lower level so I started trying to make sense by writing up a bunch of should/should-not behaviors based on a module or section of the UI rather than specifics about classes and functions. Then I started thinking how would I convert this into code. So I went to look at PHPSpec and I can't see the difference now.

It seems that PHPSpec is just a more user friendly (to the coder) way of doing the same thing as PHPUnit or SimpleTest.

The example here http://www.phpspec.net/documentation/writing-specs.html#spec-dsl could be done with PHPUnit style syntax and they are actually testing the same things such as the log file example. It is more or less testing on the same level as the simpletest logging example below.

PHP Code:

TestOfLogging extends UnitTestCase {
testLogCreatesNewFileOnFirstMessage() {
$log = new Log('/temp/test.log');
$log->message('Should write this to a file');

Can anyone shed some light on the difference and where using both testing frameworks could be beneficial? I can see that running the same test two different ways might increase confidence in the code. But this might be overkill.

I guess what I'm looking for is a way to justify using BDD as a level of testing somewhere between TDD and UAT(User Acceptance Testing). Otherwise I should just forget PHPSpec until it is more widely accepted and stick with PHPUnit or Simpletest.

Thanks for your input :-)