1.1. What Is Behaviour Driven Development (Bdd) ?

BDD (Behavior Driven Development) is a new paradigm in software engineering. It takes a different approach as compared to the traditional Waterfall Model used in Software Engineering.

It helps you specify the tests for the system in more human languages. (Not necessarily English, it can be French, German, etc. as well if you wish!)

It helps to write/specify Tests (behaviour) of the System by Non Technical People.

Given I have 100 Cows When I sell 2 Cows Then I must have 98 Cows

The above test, in some technical language like C++ would be similar to below…

void test_SellTwoCows() {

    auto oCowBarn = CowBarn(100);

    auto oSeller = CowSeller();

    auto sell_status = oSeller.sell(
        oCowBarn, /*< From this barn */
        2 /*< This count */

        0 == sell_status,
        "Selling of 2 cows must be successful");

        (100 -2 ) == oCow.getCount(),
        "We must have 100 - 2 == 98 cows remaining after the sale");

So, in a birds eye view, BDD helps to specify behaviour of the system without going too deep into technical details.

Imagine the system is re-written from C++ to either a higher level language like Python or other system programming language like Rust, the developers would have to re-write the whole program.

On contrast, because of BDD, an extremely high level and un-precedented level of re-use is possible. The reason is, even if you change the programming language and re-write the whole system, the behaviour that you expect from the new system must be same as the old/existing system.