I know BDD and also read Specification by Example the great book by Gojko Adzic; As I understand they are almost the same and have many in common; But I was not able to understand their main difference. I mean Can we use them interchangeably?
BDD is the format of describing tests in a form of "this functionality does this and that". If requirements are written in the same format, then we end up with the whole team using BDD. Because these requirements can be reused for testing.
Specs by example is.. well, putting a particular example into the requirements.
BDD-for-testing can come in different forms:
As for BDD-for-requirements, here's an example:
If user has sufficient amounts of money, they can buy the product
And here is Specs-by-example:
If user has 10$ and the product is 9$, user can buy that product
See, in the 1st example we used abstract ideas, while in the latter one we used particular values.
Oftentimes when people talk about BDD/Specs-by-example, they would write requirements using Given-When-Then. But as an abstract idea this isn't compulsory - it's just what most testing frameworks support it.
Overall, BDD is a very good idea for testing, especially if it's not a Given-When-Then :) But when it comes to requirements - I haven't seen any project in my experience that really benefited from it.
As for other common misconceptions: BDD and how it does NOT relate to TDD.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With